Skip to content

Wnck: Use frame geometry when client geometry includes CSD

As described in more detail in the commits for pending MR [1], based on the discussion in [2], window-relative coordinates reported via AT-SPI are in general relative to the top-left corner of the window's client geometry if the window has no client side decoration and relative to the frame geometry if the window has client side decoration.

The Wnck-based implementation (so far used for GTK 4 applications and only working properly on X11 or XWayland) was unconditionally using the client geometry so far. For gtk4-demo, this worked fine in a Plasma X11 session (and by now also in a Plasma Wayland session on Debian testing in a retest), but led to highlighting being slightly off for gtk4-demo in a GNOME X11 session or when running gtk4-demo on XWayland (forced via GDK_BACKEND=x11) in a GNOME Wayland session.

Fix this in line with what MR [1] does for the KWinWinManager implementation: Assume that client-side decoration is used when the client geometry is larger than the frame geometry and use the frame geometry in that case. That results in correct highlighting for the GNOME case as well, both on X11 and when running on XWayland in a GNOME Wayland session.

This addresses this aspect mentioned in the commit adding the original implementation:

commit 238db8fbb85bb2b2bdb1f36a0fd502b3236051b6
Author: Michael Weghorn <m.weghorn@posteo.de>
Date:   Thu Oct 5 18:22:13 2023 +0200

    node: Calculate screen coords for gtk4 apps

At least in a test with gtk4-demo, this makes highlighting the selected a11y object work on X11. (The highlighted rectangle looks exactly correct for me in a KDE Plasma X11 session on Debian testing, but some pixels off in a GNOME X11 session or when running on XWayland in a KDE Plasma Wayland session. Without further analysis, I'd assume that's a problem of libwnck not being able to retrieve the exact position from the window manager.)

This doesn't chane anything about the fact that the Wnck implementation is uncapable of getting proper coordinates for apps natively running on Wayland rather than as X clients on XWayland.

[1] !57 [2] gnome-shell#7559 (closed)

Merge request reports