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());