Simplify X11Window::updateServerGeometry()

There are two shapes that the WM needs to be concerned about: the input
shape and normal shape.

If the client window has custom input shape, the window manager should
synchronize it with all parent windows or ensure that its frame window
has an input shape as big as the client's input shape. The input shape
needs to be updated either when the client changes it or when the
X11Window is resized or its borders have changed. updateInputShape()
accomplishes that.

The normal shape is slightly different. If the window is decorated, the
window manager could ignore the shape set by the client. If the window
is not decorated, it's a good idea for the WM to synchronize client's
shape with the frame window's shape (if there's any). The frame window
shape doesn't need to be updated when it's resized, but if the client
window moves inside the frame window, it needs to be updated.

This change removes too generic updateShape() in the
X11Window::moveResize() code path and replaces it with a more targeted
code to update the shape, so updateServerGeometry() does not emit the
shapeChanged signal and it can be reused in the doInteractiveResizeSync()
function. Note that on wayland, it's unnecessary to synchronize the
shapes because the client window never moves in the frame window but it
is done anyway to minimize the differences between X and Wayland sessions
for easier maintenance.
This commit is contained in:
Vlad Zahorodnii 2024-06-27 23:27:15 +03:00
parent 9d9c7fe883
commit 8cb7e0a26b

View file

@ -4431,7 +4431,16 @@ void X11Window::updateServerGeometry()
// THOMAS - yes, but gtk+ clients will not resize without ...
sendSyntheticConfigureNotify();
}
updateShape();
// TODO: This is not required on wayland, keep it until we support Xorg session.
if (is_shape) {
if (!isDecorated()) {
xcb_shape_combine(kwinApp()->x11Connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
XCB_SHAPE_SK_BOUNDING, frameId(), m_wrapper.x(), m_wrapper.y(), window());
}
}
updateInputShape();
updateInputWindow();
} else {
m_frame.move(Xcb::toXNative(m_bufferGeometry.topLeft()));