From 2a09259cc2184c472da86cb323598862a012f543 Mon Sep 17 00:00:00 2001 From: Zhang Qipeng Date: Fri, 25 Sep 2020 19:53:49 +0800 Subject: [PATCH] fix: The taskbar range is calculated incorrectly when zoomed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 计算任务栏外部区域时,后端传来的值均为实际值(不受缩放影响的实际屏幕参数),参与计算的均为实际值; 但是当开启缩放后,任务栏在视觉上的高(宽)度比缩放前大,应该乘一个缩放比例,才是任务栏实际的像素高度; 由于后面判断隐藏任务栏时机的时候,是用获取的鼠标坐标实际值与之前存的任务栏的边界作比较,相等时执行隐藏任务栏的动画; 如果之前保存的任务栏参数没有乘缩放比例,那它的高度值只能在40~100之间浮动,但是开启缩放1.25后,它的像素高度应该在50~125之间浮动; 故拿减去实际像素值的范围与鼠标坐标判断才能获取到准确的范围。 Log: 修复开启缩放后任务栏提前隐藏的问题。 Bug: https://pms.uniontech.com/zentao/bug-view-49297.html Change-Id: If8c3b28be213fe67f0085d64bad6d63f19edc4a3 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/6348 Reviewed-by: Reviewed-by: fanpengcheng Tested-by: --- frame/util/multiscreenworker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 1914c6aa8..9e929208d 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -548,9 +548,9 @@ void MultiScreenWorker::onRequestUpdateRegionMonitor() } const static int flags = Motion | Button | Key; - const static int monitorHeight = 15; + const static int monitorHeight = static_cast(15 * qApp->devicePixelRatio()); // 后端认为的任务栏大小(无缩放因素影响) - const int realDockSize = int(m_displayMode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() + 2 * 10/*上下的边距各10像素*/ : m_dockInter->windowSizeEfficient()); + const int realDockSize = int((m_displayMode == DisplayMode::Fashion ? m_dockInter->windowSizeFashion() + 2 * 10 /*上下的边距各10像素*/ : m_dockInter->windowSizeEfficient()) * qApp->devicePixelRatio()); // 任务栏唤起区域 m_monitorRectList.clear();