#1120407 qt6-wayland: Application aborts with "'xdg_toplevel' has no event 3" on Swaywm 1.10-2

Package:
qt6-wayland
Source:
qt6-wayland
Description:
Qt 6 Wayland platform plugin
Submitter:
Phil Ashby
Date:
2025-11-08 22:15:02 UTC
Severity:
normal
Tags:
#1120407#5
Date:
2025-11-08 21:40:07 UTC
From:
To:
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.