mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-07-17 06:21:11 +00:00
wayland: 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.
See also https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/533
(cherry picked from commit 6eba2f2efe)
This commit is contained in:
committed by
Frank Praznik
parent
29d07d3ed1
commit
3e536ede68
@@ -110,7 +110,9 @@
|
||||
#define SDL_WL_DATA_DEVICE_VERSION 3
|
||||
|
||||
// wl_fixes was introduced in 1.24.0
|
||||
#if SDL_WAYLAND_CHECK_VERSION(1, 24, 0)
|
||||
#if SDL_WAYLAND_CHECK_VERSION(1, 26, 0)
|
||||
#define SDL_WL_FIXES_VERSION 2
|
||||
#elif SDL_WAYLAND_CHECK_VERSION(1, 24, 0)
|
||||
#define SDL_WL_FIXES_VERSION 1
|
||||
#endif
|
||||
|
||||
@@ -506,7 +508,11 @@ static void wayland_preferred_check_handle_global(void *data, struct wl_registry
|
||||
|
||||
static void wayland_preferred_check_remove_global(void *data, struct wl_registry *registry, uint32_t id)
|
||||
{
|
||||
// No need to do anything here.
|
||||
SDL_WaylandPreferredData *d = (SDL_WaylandPreferredData *)data;
|
||||
|
||||
if (d->wl_fixes && wl_fixes_get_version(d->wl_fixes) >= WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION) {
|
||||
wl_fixes_ack_global_remove(d->wl_fixes, registry, id);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener preferred_registry_listener = {
|
||||
@@ -1370,18 +1376,22 @@ static void handle_registry_remove_global(void *data, struct wl_registry *regist
|
||||
}
|
||||
|
||||
d->output_count--;
|
||||
return;
|
||||
goto ack_remove;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_WaylandSeat *seat, *temp;
|
||||
wl_list_for_each_safe (seat, temp, &d->seat_list, link)
|
||||
{
|
||||
wl_list_for_each_safe (seat, temp, &d->seat_list, link) {
|
||||
if (seat->registry_id == id) {
|
||||
Wayland_SeatDestroy(seat, false);
|
||||
return;
|
||||
goto ack_remove;
|
||||
}
|
||||
}
|
||||
|
||||
ack_remove:
|
||||
if (d->wl_fixes && wl_fixes_get_version(d->wl_fixes) >= WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION) {
|
||||
wl_fixes_ack_global_remove(d->wl_fixes, registry, id);
|
||||
}
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener registry_listener = {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user