From 105df289cc412889a211dd22d754a9d0c0056fff Mon Sep 17 00:00:00 2001 From: donghualin Date: Tue, 27 Dec 2022 15:30:50 +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=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、开始菜单位置显示错误问题 2、应用图标显示错误问题 Log: 修复高缩放率下的显示问题 Influence: 设置高缩放率,观察开始菜单的位置,任务栏图标占满区域,左右位置,观察任务栏图标是否拥挤 Bug: https://pms.uniontech.com/bug-view-176421.html Change-Id: I038e28df2e9676fbfc8cf3732c6bee5c335f20d3 --- frame/window/mainpanelcontrol.cpp | 1 + frame/window/windowmanager.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frame/window/mainpanelcontrol.cpp b/frame/window/mainpanelcontrol.cpp index efc6531a8..c6f6df6d7 100755 --- a/frame/window/mainpanelcontrol.cpp +++ b/frame/window/mainpanelcontrol.cpp @@ -1255,6 +1255,7 @@ void MainPanelControl::resizeDockIcon() iconSize = (totalLength - yu) / iconCount; } + iconSize = iconSize / qApp->devicePixelRatio(); if ((m_position == Position::Top) || (m_position == Position::Bottom)) { if (iconSize >= height()) { calcuDockIconSize(height(), height(), tray_item_size); diff --git a/frame/window/windowmanager.cpp b/frame/window/windowmanager.cpp index 71f5480d6..775c2c60d 100644 --- a/frame/window/windowmanager.cpp +++ b/frame/window/windowmanager.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -676,8 +677,18 @@ void WindowManager::onRequestUpdateFrontendGeometry() if (rect.width() == 0 || rect.height() == 0) return; + 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; + } + DockInter dockInter(dockServiceName(), dockServicePath(), QDBusConnection::sessionBus()); - dockInter.SetFrontendWindowRect(int(rect.x()), int(rect.y()), uint(rect.width()), uint(rect.height())); + dockInter.SetFrontendWindowRect(x, y, uint(rect.width()), uint(rect.height())); } void WindowManager::onRequestNotifyWindowManager()