fix: 判断鼠标坐标时需要考虑在显示器边缘的情况

在多显示器拼接时,鼠标在拼接处移动时,需要考虑鼠标坐标不在显示器的rect区域内,需要单独处理

Log: 修复扩展模式下任务栏跟随主屏时任务栏会在副屏闪烁问题
Bug: https://pms.uniontech.com/zentao/bug-view-94504.html
Change-Id: I36a434bd5d385735ebfa9f1c4d01c31c830f84d2
This commit is contained in:
chenjun 2021-09-23 16:20:27 +08:00
parent 20c5ed8576
commit 916ab6482b

View File

@ -1455,13 +1455,13 @@ bool MultiScreenWorker::onScreenEdge(const QString &screenName, const QPoint &po
// 除了要判断鼠标的x坐标和当前区域的位置外还需要判断当前的坐标的y坐标是否在任务栏的区域内
// 因为有如下场景任务栏在左侧双屏幕屏幕上下拼接此时鼠标沿着最左侧x=0的位置移动到另外一个屏幕
// 如果不判断y坐标的话此时就认为鼠标在当前任务栏的边缘导致任务栏在这种状况下没有跟随鼠标
if ((rect.x() == point.x() || rect.right() == point.x())
if ((rect.x() == point.x() || rect.x() + rect.width() == point.x())
&& point.y() >= rect.top() && point.y() <= rect.bottom()) {
return true;
}
// 同上,不过此时屏幕是左右拼接,任务栏位于上方或者下方
if ((rect.y() == point.y() || rect.bottom() == point.y())
if ((rect.y() == point.y() || rect.y() + rect.height() == point.y())
&& point.x() >= rect.left() && point.x() <= rect.right()) {
return true;
}