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.

(cherry-picked from commit 6e7268e42a)
This commit is contained in:
Sergio Martins
2022-06-19 12:54:12 +01:00
parent 4c177d7823
commit 793661ea09
2 changed files with 13 additions and 1 deletions

View File

@@ -126,7 +126,7 @@ FloatingWindow::FloatingWindow(QRect suggestedGeometry, MainWindow *parent)
view()->setGeometry(suggestedGeometry);
#ifdef Q_OS_WIN
// For QtQuick we do it a bit later, once we have the QQuickWindow
// For QtQuick we do it a bit later, once we have the QQuickWindow
#ifdef KDDW_FRONTEND_QTWIDGETS
if (Platform::instance()->isQtWidgets()) {
view()->createPlatformWindow(); // QWidget::create

View File

@@ -416,6 +416,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->view()->window()->setFramePosition(globalPos - q->m_offset);