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.
This commit is contained in:
Martchus 2023-10-06 17:55:51 +02:00
parent a9cc948099
commit cdfa769c84
1 changed files with 11 additions and 0 deletions

View File

@ -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)