xwayland: Add support for wl_fixes.ack_global_remove

The wl_fixes.ack_global_remove request signals the compositor that the
client will not bind the removed global. It can be used by the
compositor to decide when it is safe to actually destroy the
corresponding global. If a global is destroyed too soon, some clients may
get disconnected.

Signed-off-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
This commit is contained in:
Vlad Zahorodnii 2026-03-13 23:11:44 +02:00
parent 25c15afe70
commit 2ed37e6ed9
3 changed files with 10 additions and 3 deletions

View file

@ -3181,13 +3181,17 @@ input_handler(void *data, struct wl_registry *registry, uint32_t id,
init_system_bell(xwl_screen, id, version);
} else if (strcmp(interface, wl_fixes_interface.name) == 0) {
xwl_screen->input_fixes =
wl_registry_bind(registry, id, &wl_fixes_interface, 1);
wl_registry_bind(registry, id, &wl_fixes_interface, min(version, 2));
}
}
static void
global_remove(void *data, struct wl_registry *registry, uint32_t name)
{
struct xwl_screen *xwl_screen = data;
if (xwl_screen->input_fixes && wl_fixes_get_version(xwl_screen->input_fixes) >= WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION)
wl_fixes_ack_global_remove(xwl_screen->input_fixes, xwl_screen->input_registry, name);
}
static const struct wl_registry_listener input_listener = {

View file

@ -571,7 +571,7 @@ registry_global(void *data, struct wl_registry *registry, uint32_t id,
#endif
else if (strcmp(interface, wl_fixes_interface.name) == 0) {
xwl_screen->fixes =
wl_registry_bind(registry, id, &wl_fixes_interface, 1);
wl_registry_bind(registry, id, &wl_fixes_interface, min(version, 2));
}
}
@ -597,6 +597,9 @@ global_remove(void *data, struct wl_registry *registry, uint32_t name)
break;
}
}
if (xwl_screen->fixes && wl_fixes_get_version(xwl_screen->fixes) >= WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION)
wl_fixes_ack_global_remove(xwl_screen->fixes, registry, name);
}
static const struct wl_registry_listener registry_listener = {

View file

@ -66,7 +66,7 @@ libdrm_req = '>= 2.4.116'
libselinux_req = '>= 2.0.86'
xext_req = '>= 1.0.99.4'
xproto_req = '>= 7.0.31'
wayland_req = '>= 1.23.91'
wayland_req = '>= 1.25.90'
wayland_protocols_req = '>= 1.38'
gbm_req = '>= 10.2'
xf86dgaproto_req = '>= 2.0.99.1'