diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2026-07-30 09:09:22 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2026-08-19 04:44:38 +0000 |
| commit | 85655c74a4ded119392ea8b632626c3920042807 (patch) | |
| tree | 5cdd59c1cc55fe24af4fcc69366619bb3e6056e1 | |
| parent | term: don't do a cursor refresh if we're shutting down (diff) | |
wayland: handle_global_remove(): call wl_fixes::ack_global_remove(), when available
wayland 1.26 adds wl_fixes::ack_global_remove(). Clients should call
it when they've received a global_remove() event, after doing internal
cleanup.
Not tested yet:
* Waiting for arch to update wayland to 1.26
* None of the compositors I use (or test on) implement it yet.
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | wayland.c | 36 | ||||
| -rw-r--r-- | wayland.h | 4 |
3 files changed, 39 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e9f637b9..67b64049 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -79,6 +79,7 @@ * Support for [terminal visibility reports](https://rockorager.dev/misc/visibility-reports/), using the Wayland `xdg_toplevel` suspended state. +* Support for `wl_fixes::ack_global_remove()`. [2368]: https://codeberg.org/dnkl/foot/issues/2368 @@ -1588,6 +1588,24 @@ handle_global(void *data, struct wl_registry *registry, wayl->color_management.manager, &color_manager_listener, wayl); } +#if defined(WL_FIXES_INTERFACE) + else if (streq(interface, wl_fixes_interface.name)) { + const uint32_t required = 1; + if (!verify_iface_version(interface, version, required)) + return; + +#if defined(WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION) + const uint32_t preferred = WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION; +#else + const uint32_t preferred = required; +#endif + + wayl->fixes_version = min(version, preferred); + wayl->fixes = wl_registry_bind( + wayl->registry, name, &wl_fixes_interface, wayl->fixes_version); + } +#endif + #if defined(HAVE_XDG_TOPLEVEL_TAG) else if (streq(interface, xdg_toplevel_tag_manager_v1_interface.name)) { const uint32_t required = 1; @@ -1678,7 +1696,7 @@ handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) monitor_destroy(mon); tll_remove(wayl->monitors, it); - return; + goto ack_remove; } /* A seat? */ @@ -1712,10 +1730,20 @@ handle_global_remove(void *data, struct wl_registry *registry, uint32_t name) seat_destroy(seat); tll_remove(wayl->seats, it); - return; + goto ack_remove; } LOG_WARN("unknown global removed: 0x%08x", name); + +ack_remove: + ; +#if defined(WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION) + if (wayl->fixes != NULL && + wayl->fixes_version >= WL_FIXES_ACK_GLOBAL_REMOVE_SINCE_VERSION) + { + wl_fixes_ack_global_remove(wayl->fixes, wayl->registry, name); + } +#endif } static const struct wl_registry_listener registry_listener = { @@ -1987,6 +2015,10 @@ wayl_destroy(struct wayland *wayl) wl_subcompositor_destroy(wayl->sub_compositor); if (wayl->compositor != NULL) wl_compositor_destroy(wayl->compositor); +#if defined(WL_FIXES_INTERFACE) + if (wayl->fixes != NULL) + wl_fixes_destroy(wayl->fixes); +#endif if (wayl->registry != NULL) wl_registry_destroy(wayl->registry); if (wayl->fd != -1) @@ -457,6 +457,10 @@ struct wayland { struct wl_display *display; struct wl_registry *registry; +#if defined(WL_FIXES_INTERFACE) + struct wl_fixes *fixes; + int fixes_version; +#endif struct wl_compositor *compositor; struct wl_subcompositor *sub_compositor; struct wl_shm *shm; |
