Skip to content

Make checkWorkspacePosition() work without client geometry

Vlad Zahorodnii requested to merge work/zzag/less-client-geometry into master

A good portion of geometry handling code was written during the X11 times. The main difference between X11 and Wayland is that kwin doesn't know where a window will exactly be after resize() or moveResize().

In order to handle Wayland specifics, every window has a bounding geometry that is being manipulated by move(), resize(), and moveResize(). The frameGeometry(), the clientGeometry(), and the bufferGeometry() are not manipulated by move(), resize(), and moveResize() directly. Almost everything that manipulates geometry should use moveResizeGeometry().

This creates a problem though, since the clientGeometry() will be updated only after the client provides a new buffer, kwin has absolutely no idea what the client geometry for a given move resize geometry will be.

Another side of the coin is that decoration updates are performed asynchronously on wayland, meaning that you cannot use border properties for anything related to geometry handling and you should avoid using borderLeft(), borderTop(), borderRight(), and borderBottom() in general.

clientGeometry(), bufferGeometry(), and border*() are good only if you want to forward an event or render something. They can't be used for manipulating the geometry.

Unfortunately, AbstractClient::checkWorkspacePosition() needs both, which is a bit of a problem. To add more oil to the fire, contents of a decorated window can be snapped to a screen edge. This goes against the nature of geometry updates on wayland, where we try to indicate the bounds of the frame geometry and avoid using client and buffer geometries.

In order to make geometry handling more correct on wayland, this change removes the ability to snap the contents of a decorated window to a screen edge. This allows to avoid using the client geometry in checkWorkspacePosition(), which is a very important function that ensures the window is inside the workspace.

There is nothing wrong with snapping the frame rather than its contents and that's what kwin used to do. It was changed with the removal of "Display borders on maximized windows" option, the relevant commit didn't provide any reasoning behind the change.

Merge request reports