-
Michael Weghorn authored
Add a `KWinWindowManager` that can be used to retrieve window positions using the KWin window manager/Wayland compositor that is used on KDE Plasma by default. In order to do that, a JavaScript KWin script is used that retrieves the global/screen positions of windows using KWin's scripting API [1]. The script can be loaded and run via DBus. (python3-dbus is used for this, added as a new dependency.) Unfortunately, the script output is currently not available via DBus, which seems to be a KDE bug, see [2] [3] [4]. As a workaround, retrieve the script output from the journal using `journalctl` instead, see also the discussion in [4]. For now, the Wnck-based window manager (that doesn't work on Wayland with native Wayland apps, see issue #41) remains the default. Use of the KWin window manager can explicitly be enabled by setting the environment variable `ACCERCISER_WINDOW_MANAGER=kwin`. (Adding some heuristics to choose a WindowManager might make sense at some point in the future once this is more feature-complete.) Using the new WindowManager in a KDE Plasma 5 Wayland session on Debian testing (kwin-wayland at package version 4:5.27.10-1) results in objects in the a11y tree view being highlighted as expected in most, but not all cases yet: * Qt apps like the "standarddialogs" example from qtbase or the qt6-based LO variant work fine when run as a native Wayland application. * When run on XWayland (forced via `QT_QPA_PLATFORM=xcb`) the qtbase "standarddialogs" sample highlighting is slightly incorrect for the initial window; the window frame/decoration doesn't seem to be taken into account properly, so the highlighting rectangle is a bit too far up. The actual dialogs that can be run in that sample are handled correctly again, though. * GTK 4 application "transmission-gtk" (version 4.0.5-1) works fine. * for (GTK 3) gedit (version 46.1-3), the area highlighted for the top-level frame is odd, but anything else looks fine. * For gtk4-demo, the highlighted area is slightly off (maybe around 30 pixels too far on the left and top). This partly solves #41 by providing an initial solution when KDE Plasma Wayland with KWin is used, at least for the highlighting part. More work is needed to make the quick select feature using the mouse position work as well. A similar approach should generally be possible for GNOME/Mutter. [1] https://develop.kde.org/docs/plasma/kwin/api/ [2] https://bugs.kde.org/show_bug.cgi?id=477069 [3] https://bugs.kde.org/show_bug.cgi?id=392840 [4] https://bugs.kde.org/show_bug.cgi?id=445058
6526519b