From 6f153552dab35f46bc88c0b736a16a47cc3297d4 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 28 Sep 2020 11:27:45 +0300 Subject: [PATCH] Allow calling setFrameGeometry() while the client is being resized Currently, if some script attempts to resize a window while it's being interactively resized, the corresponding change won't be propagated to the X server. The main reason for that is that we don't want to configure the frame window, the wrapper window, and the client window twice. However, since Xcb::Window keeps track of the last configured geometry, we can adjust X11Client::updateServerGeometry() so it only configures windows that have mismatching geometry. By doing so, the setFrameGeometry() function can be called by scripts even when the associated X11 window is being interactively resized. Note that this bug doesn't affect Wayland windows. BUG: 426988 --- x11client.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/x11client.cpp b/x11client.cpp index 814237dad..a52166d90 100644 --- a/x11client.cpp +++ b/x11client.cpp @@ -4284,15 +4284,18 @@ void X11Client::updateServerGeometry() resizeDecoration(); // If the client is being interactively resized, then the frame window, the wrapper window, // and the client window have correct geometry at this point, so we don't have to configure - // them again. If the client doesn't support frame counters, always update geometry. - const bool needsGeometryUpdate = !isResize() || m_syncRequest.counter == XCB_NONE; - if (needsGeometryUpdate) { + // them again. + if (m_frame.geometry() != m_bufferGeometry) { m_frame.setGeometry(m_bufferGeometry); } if (!isShade()) { - if (needsGeometryUpdate) { - m_wrapper.setGeometry(QRect(clientPos(), clientSize())); - m_client.setGeometry(QRect(QPoint(0, 0), clientSize())); + const QRect requestedWrapperGeometry(clientPos(), clientSize()); + if (m_wrapper.geometry() != requestedWrapperGeometry) { + m_wrapper.setGeometry(requestedWrapperGeometry); + } + const QRect requestedClientGeometry(QPoint(0, 0), clientSize()); + if (m_client.geometry() != requestedClientGeometry) { + m_client.setGeometry(requestedClientGeometry); } // SELI - won't this be too expensive? // THOMAS - yes, but gtk+ clients will not resize without ...