Wayland: wl_compositor and wl_data_device_manager are bound at version 3 whatever the offer, and a second xdg_wm_base or wl_seat global overwrites the first #195
Labels
No labels
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Graphics#195
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Device::handle_globalbindswl_compositorandwl_data_device_managerat version 3 whatever version the compositor offers. A bind above the offer is a protocol error that ends the connection, so on a compositor that offers either below 3 no window would open at all. And of all the globals onlywl_compositoris bound once: a secondxdg_wm_baseorwl_seatadvertisement binds again and overwrites the first proxy. Line numbers refer toc006519.Details
implementations/Crafter.Graphics-Device.cpp:319:wl_registry_bind(registry, name, &wl_compositor_interface, 3).:339-340: the same forwl_data_device_manager_interface. Neither looks at the handler'sversionargument.:335-338expects a fallback for a compositor without version 3 ("the per-source listener simply not getting the v3-only callbacks"). There is none: libwayland's server answers such a bind with a protocol error,invalid version for global ...: expected at most %d, got %d(wayland 1.26.0,src/wayland-server.c:1086-1090), and a protocol error is fatal to the client's connection.tests/ToplevelState/main.cpp:24-27says the same ofxdg_wm_base.:326, sincec006519, is the one bind that respects the offer:std::min<std::uint32_t>(version, 6).:318:compositor == nullptr &&guards thewl_compositorbranch. Thexdg_wm_basebranch (:320-327) and thewl_seatbranch (:304-317) have no such guard, andhandle_global_remove(:480-482) is empty. A second advertisement of either overwritesDevice::xdgWmBaseorDevice::seatand adds a listener to the new proxy; the first proxy is leaked, and the windows made from the firstxdg_wm_basego on using it.On KWin 6.8.0 the offers are
wl_compositor6,wl_data_device_manager3,wl_seat11 andwl_shm2 (read off aWAYLAND_DEBUG=1run on 2026-11-17), so nothing goes wrong there. Latent.Found by reading the code, in the pre-push review of 364d210..c006519. It is older than that range, which changed only the
xdg_wm_basebind's version. Not reproduced: no compositor that offers either global below version 3, and none with two seats, was tried.Suggested fix
Bind each at
std::min(version, <the version the code is written for>), as thexdg_wm_basebranch does, and stop relying on what the lower version lacks: forwl_data_device_managerbelow 3, thewl_data_sourceevents of version 3. Give thexdg_wm_baseandwl_seatbranches the== nullptrguardwl_compositorhas, or handle a second seat on purpose.