From cdfa769c84db1aa2b7e36c580d2f163bc10e01d7 Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 6 Oct 2023 17:55:51 +0200 Subject: [PATCH] Disable resizing/moving for popups under X11 as it is not working At least it wasn't working with KWin and leading to the popup not closing correctly anymore. --- tray/gui/traymenu.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tray/gui/traymenu.cpp b/tray/gui/traymenu.cpp index 00b524d..25210d4 100644 --- a/tray/gui/traymenu.cpp +++ b/tray/gui/traymenu.cpp @@ -112,6 +112,17 @@ void TrayMenu::mousePressEvent(QMouseEvent *event) // try starting a system window resize/move to allow resizing/moving the borderless window #ifdef QT_SUPPORTS_SYSTEM_WINDOW_COMMANDS if (auto *const window = this->windowHandle()) { + // keep default behavior on X11 for popups as the start functions don't work there (even though they return true) +#if defined(Q_OS_UNIX) && !(defined(Q_OS_ANDROID) || defined(Q_OS_DARWIN)) + if (m_windowType == TrayMenu::WindowType::Popup) { + static const auto platform = QGuiApplication::platformName(); + if (!platform.compare(QLatin1String("xcb"), Qt::CaseInsensitive)) { + QMenu::mousePressEvent(event); + return; + } + } +#endif + // check relevant edges and start the appropriate system resize/move const auto pos = event->pos(); auto edges = Qt::Edges(); if (pos.x() < border)