mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
fix: 修改任务栏判断鼠标在任务栏边缘的方式
双屏幕的情况下,在当前鼠标位置的x和任务栏的x坐标相等的情况下,增加鼠标位置的y坐标在任务栏的上下区域内的判断;同时,在鼠标的y坐标和任务栏的y坐标相等的情况下,判断鼠标的X坐标是否在任务栏的左右区域内 Log: 修复双屏情况下鼠标无法唤起任务栏的bug Bug: https://pms.uniontech.com/zentao/bug-view-89237.html Change-Id: I7ce288090911aacb5f1193a314bc285f168eea46
This commit is contained in:
parent
3960e7b359
commit
32894dd413
@ -1474,18 +1474,27 @@ QScreen *MultiScreenWorker::screenByName(const QString &screenName)
|
||||
|
||||
bool MultiScreenWorker::onScreenEdge(const QString &screenName, const QPoint &point)
|
||||
{
|
||||
bool ret = false;
|
||||
QScreen *screen = screenByName(screenName);
|
||||
if (screen) {
|
||||
const QRect r { screen->geometry() };
|
||||
const QRect rect { r.topLeft(), r.size() *screen->devicePixelRatio() };
|
||||
if (rect.x() == point.x()
|
||||
|| rect.x() + rect.width() == point.x()
|
||||
|| rect.y() == point.y()
|
||||
|| rect.y() + rect.height() == point.y())
|
||||
ret = true;
|
||||
|
||||
// 除了要判断鼠标的x坐标和当前区域的位置外,还需要判断当前的坐标的y坐标是否在任务栏的区域内
|
||||
// 因为有如下场景:任务栏在左侧,双屏幕屏幕上下拼接,此时鼠标沿着最左侧x=0的位置移动到另外一个屏幕
|
||||
// 如果不判断y坐标的话,此时就认为鼠标在当前任务栏的边缘,导致任务栏在这种状况下没有跟随鼠标
|
||||
if ((rect.x() == point.x() || rect.right() == point.x())
|
||||
&& point.y() >= rect.top() && point.y() <= rect.bottom()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 同上,不过此时屏幕是左右拼接,任务栏位于上方或者下方
|
||||
if ((rect.y() == point.y() || rect.bottom() == point.y())
|
||||
&& point.x() >= rect.left() && point.x() <= rect.right()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const QPoint MultiScreenWorker::rawXPosition(const QPoint &scaledPos)
|
||||
|
Loading…
x
Reference in New Issue
Block a user