node: Calculate screen coords for gtk4 apps
In order to highlight the accessible object currently selected in Accerciser's tree view, the screen coordinates need to be known.
gtk4 does not support querying screen/global coordinates via AT-SPI any more.
Therefore, don't try to query them directly via
AT-SPI, but query window-relative coordinates
for the object via AT-SPI and try to retrieve
the screen coordinates for the top-level window
via Wnck. Use the window title/name to match
the a11y object to the Wnck window, as is done
in QuickSelect#_inspectUnderMouse
. This
isn't guaranteed to actually find the matching
window in all cases (e.g. didn't work for Qt 5
applications like Kate or NeoChat, but did for the Gtk
applications I tested with and some
sample Qt 6 qtbase example apps).
For now, restrict using that approach only for apps reporting Gtk >= 4 as toolkit. Fall back to the previous approach of directly querying screen coords via AT-SPI if the new approach doesn't give a result.
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 does not fix the general problem that screen coordinates are not supported on Wayland, but it should be possible to extend this approach to cover that case as well by retrieving the screen position of the window in a different way, e.g. directly from the window manager/ Wayland compositor.