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
master
Vlad Zahorodnii 2020-09-28 11:27:45 +03:00
parent ddb24eaf0a
commit 6f153552da
1 changed files with 9 additions and 6 deletions

View File

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