From 05a98ac8b78c82bd4ea52cc65d5edbf4d977bc7f Mon Sep 17 00:00:00 2001 From: donghualin Date: Tue, 3 Jan 2023 18:05:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=AB=98=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E7=8E=87=E4=B8=8B=E9=AB=98=E6=95=88=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=99=A8=E4=BD=8D=E7=BD=AE=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 高效模式下,启动器使用自己计算的坐标来处理 Log: 修复高缩放率下高效模式启动器位置错误 Influence: 高缩放率下进入高效模式,观察启动器的位置 Task: https://pms.uniontech.com/task-view-232903.html Change-Id: Ic0a40476e13f7d8fe83f5bf537388e0b4df339e0 --- frame/window/windowmanager.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/frame/window/windowmanager.cpp b/frame/window/windowmanager.cpp index 775c2c60d..4181ba1eb 100644 --- a/frame/window/windowmanager.cpp +++ b/frame/window/windowmanager.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -679,12 +680,14 @@ void WindowManager::onRequestUpdateFrontendGeometry() int x = rect.x(); int y = rect.y(); - QScreen *screen = DIS_INS->screen(DOCKSCREEN_INS->current()); - if (screen) { - if (m_position == Dock::Position::Top || m_position == Dock::Position::Bottom) - x = (screen->handle()->geometry().width() - (rect.width() * qApp->devicePixelRatio())) / 2; - else - y = (screen->handle()->geometry().height() - (rect.height() * qApp->devicePixelRatio())) / 2; + if (m_displayMode == Dock::DisplayMode::Fashion) { + QScreen *screen = DIS_INS->screen(DOCKSCREEN_INS->current()); + if (screen) { + if (m_position == Dock::Position::Top || m_position == Dock::Position::Bottom) + x = qMax(0, (int)((screen->handle()->geometry().width() - (rect.width() * qApp->devicePixelRatio())) / 2)); + else + y = qMax(0, (int)((screen->handle()->geometry().height() - (rect.height() * qApp->devicePixelRatio())) / 2)); + } } DockInter dockInter(dockServiceName(), dockServicePath(), QDBusConnection::sessionBus());