From 6e7268e42af0589d7eb81aa9bbd0356ea75134fc Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Tue, 12 Apr 2022 16:37:14 +0100 Subject: [PATCH] Workaround QTBUG-102430, don't move still maximized window When dragging a maximized window we show normal, but we can only start moving it when the window managers acknowledges the new state. The state in QWidget isn't reliable. --- src/private/DragController.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/private/DragController.cpp b/src/private/DragController.cpp index 01e37819..e024ac6a 100644 --- a/src/private/DragController.cpp +++ b/src/private/DragController.cpp @@ -411,6 +411,18 @@ bool StateDragging::handleMouseMove(QPoint globalPos) return true; } +#ifdef Q_OS_LINUX + if (fw->lastWindowManagerState() == Qt::WindowMaximized) { + // The window was maximized, we dragged it, which triggers a show normal. + // But we can only start moving the window *after* the (async) window manager acknowledges. + // See QTBUG-102430. + // Since #286 was only implemented and needed on Linux, then this counter-part is also ifdefed for Linux, + // Probably the ifdef could be removed, but don't want to be testing N platforms, who's undocumented behaviour + // can change between releases, so narrow the scope and workaround for linux only. + return true; + } +#endif + if (!q->m_nonClientDrag) fw->windowHandle()->setPosition(globalPos - q->m_offset);