mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix: when multiscreen connected non-primary display unable to click popupwindow
when devicePixelRatio > 1, there is a gap between multiple screens, before currentPos multiplying by the devicePixelAatio need to subtract the topleft of the current screen and then replus the current screen topleft log: fix wrong multiScreen click pos
This commit is contained in:
parent
59f462ff09
commit
6242e642bc
@ -199,15 +199,15 @@ void DockPopupWindow::onButtonPress(int type, int x, int y, const QString &key)
|
|||||||
{
|
{
|
||||||
if (!m_enableMouseRelease)
|
if (!m_enableMouseRelease)
|
||||||
return;
|
return;
|
||||||
|
QRect screenRect = this->screen()->geometry();
|
||||||
QRect popupRect(pos() * qApp->devicePixelRatio(), size() * qApp->devicePixelRatio()) ;
|
QRect popupRect(((pos() - screenRect.topLeft()) * qApp->devicePixelRatio() + screenRect.topLeft()), size() * qApp->devicePixelRatio());
|
||||||
if (popupRect.contains(x, y))
|
if (popupRect.contains(QPoint(x, y)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (m_extendWidget) {
|
if (m_extendWidget) {
|
||||||
// 计算额外添加的区域,如果鼠标的点击点在额外的区域内,也无需隐藏
|
// 计算额外添加的区域,如果鼠标的点击点在额外的区域内,也无需隐藏
|
||||||
QPoint extendPoint = m_extendWidget->mapToGlobal(QPoint(0, 0));
|
QPoint extendPoint = m_extendWidget->mapToGlobal(QPoint(0, 0));
|
||||||
QRect extendRect(extendPoint * qApp->devicePixelRatio(), m_extendWidget->size() * qApp->devicePixelRatio());
|
QRect extendRect(((extendPoint - screenRect.topLeft()) * qApp->devicePixelRatio() + screenRect.topLeft()), m_extendWidget->size() * qApp->devicePixelRatio());
|
||||||
if (extendRect.contains(QPoint(x, y)))
|
if (extendRect.contains(QPoint(x, y)))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user