diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index 27c0286fb72ee2a4961ac638db2ebb94363227ec..fbb507c85f8841a4f36d751dbeeb0c366f1b1193 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -78,7 +78,7 @@ void WindowHelper::setRegion(QWindow *window, qreal x, qreal y, qreal w, qreal h WindowGeometryHelper::WindowGeometryHelper(QObject *parent) : QObject(parent) { initPanelSetting(); - initScreenMonitor(); +// initScreenMonitor(); updateGeometry(); connect(MenuSetting::instance(), &MenuSetting::changed, this, [this] (const QString& key) { @@ -483,8 +483,14 @@ void MenuWindow::activeMenuWindow(bool active) } if (active) { - this->setScreen(UkuiQuick::WindowProxy::currentScreen()); - updateGeometry(); + if (screen() != UkuiQuick::WindowProxy::currentScreen()) { + if (screen()) { + screen()->disconnect(this); + } + this->setScreen(UkuiQuick::WindowProxy::currentScreen()); + connect(screen(), &QScreen::geometryChanged, this, &MenuWindow::updateGeometry); + updateGeometry(); + } } setVisible(active);