fix: 修复高缩放率下高效模式启动器位置错误

高效模式下,启动器使用自己计算的坐标来处理

Log: 修复高缩放率下高效模式启动器位置错误
Influence: 高缩放率下进入高效模式,观察启动器的位置
Task: https://pms.uniontech.com/task-view-232903.html
Change-Id: Ic0a40476e13f7d8fe83f5bf537388e0b4df339e0
This commit is contained in:
donghualin 2023-01-03 18:05:20 +08:00
parent 4faedb08b8
commit 05a98ac8b7

View File

@ -35,6 +35,7 @@
#include <QX11Info>
#include <QtConcurrent>
#include <QScreen>
#include <QtGlobal>
#include <qpa/qplatformscreen.h>
#include <qpa/qplatformnativeinterface.h>
@ -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());