From b2161c6bad1f18d21378c761954b0db0246ca4fe Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 25 Jul 2024 16:50:10 +0100 Subject: [PATCH] client: Update internal geometry before notifying shell surfaces Some shell surfaces will query sizes on the window directly. In particular Xdg Shell Popup repositioning. The update is still processed before the expose event, so we have a chance to pause rendering for async geometry changes. Change-Id: I3961b282dbb450c864e3543ef267ddcd7a9c36d7 Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 581d353aaf0..23abf529e1f 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -431,6 +431,13 @@ void QWaylandWindow::setGeometry_helper(const QRect &rect) void QWaylandWindow::setGeometry(const QRect &r) { + auto rect = r; + if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup + && window()->type() != Qt::ToolTip) { + rect.moveTo(screen()->geometry().topLeft()); + } + setGeometry_helper(rect); + if (mShellSurface) { if (!mInResizeFromApplyConfigure) { const QRect frameGeometry = r.marginsAdded(clientSideMargins()).marginsRemoved(windowContentMargins()); @@ -441,13 +448,6 @@ void QWaylandWindow::setGeometry(const QRect &r) } } - auto rect = r; - if (fixedToplevelPositions && !QPlatformWindow::parent() && window()->type() != Qt::Popup - && window()->type() != Qt::ToolTip) { - rect.moveTo(screen()->geometry().topLeft()); - } - setGeometry_helper(rect); - if (window()->isVisible() && rect.isValid()) { if (mWindowDecorationEnabled) mWindowDecoration->update();