While building & testing the current stable Flightgear application with
Qt6 on my Wayland-only Sway desktop, on Debian stable (trixie), the Qt
based launcher GUI of Flightgear aborts at startup with a message that
indicates an unexpected event has occurred on the XDG Toplevel window of
the launcher.
'xdg_toplevel' has no event 3
I expect the application to run correctly and display the Flightgear
launcher GUI.
Investigating the failure, I find that event 3 (wm_capabilities) has
been part of Wayland XDG shell protocol since version 5, which is the
version offered by my Sway compositor.
https://wayland.app/protocols/xdg-shell#xdg_toplevel:event:wm_capabilities
Running with WAYLAND_DEBUG=1 I see the Qt6 library bind to version 5 of
the XDG shell protocol (xdg_wm_base), but it seems unable to process the
wm_capabilities event. I turn to the source for Qt6 to establish why it
is requesting a version that it cannot process and discover what I
believe to be a long term bug (still present in unstable, as below):
https://sources.debian.org/src/qt6-wayland/6.9.2-3/src/plugins/shellintegration/xdg-shell/qwaylandxdgshellintegration.cpp#L17
which hard-codes the supported protocol version at '6', but the Toplevel
implementation only supports event handlers for events 0,1,2 (configure,
close, configure_bounds):
https://sources.debian.org/src/qt6-wayland/6.9.2-3/src/plugins/shellintegration/xdg-shell/qwaylandxdgshell_p.h#L87
To prove this is the problem, I patch the plugin library for qt6-wayland
/usr/lib/x86_64-linux-gnu/qt6/plugins/wayland-shell-integration/libxdg-shell.so)
to lower the hard-coded protocol value to '4' (using Ghidra and tweak)
which lowers the negotiated and bound protocol version with Sway.
After refreshing the ld.so.cache Flightgear now runs it's launcher as
expected.