diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2025-01-17 09:10:10 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2025-01-17 09:21:50 +0000 |
| commit | 2a07a2e6b9a9565287996c51ceb2824b37d3fba7 (patch) | |
| tree | 6ea5fd00b24ca6275d6ab662ea2b572764aa37b9 /wayland.c | |
| parent | forgejo: bugs: short explanation of what an IME is (diff) | |
Add support for the new Wayland protocol xdg-system-bell
From the release notes:
system bell - allowing e.g. terminal emulators to hand off system
bell alerts to the compositor for among other things accessibility
purposes
The new protocol is used when the new config option
bell.system=yes (and the compositor implements the protocol,
obviously).
The system bell is rung independent of whether the foot window has
keyboard focus or not (thus relying on compositor configuration to
determine whether anything should be done or not in response to the
bell).
The new option is enabled by default.
Diffstat (limited to 'wayland.c')
| -rw-r--r-- | wayland.c | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -1374,6 +1374,17 @@ handle_global(void *data, struct wl_registry *registry, } #endif +#if defined(HAVE_XDG_SYSTEM_BELL) + else if (streq(interface, xdg_system_bell_v1_interface.name)) { + const uint32_t required = 1; + if (!verify_iface_version(interface, version, required)) + return; + + wayl->system_bell = wl_registry_bind( + wayl->registry, name, &xdg_system_bell_v1_interface, required); + } +#endif + #if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED else if (streq(interface, zwp_text_input_manager_v3_interface.name)) { const uint32_t required = 1; @@ -1696,6 +1707,10 @@ wayl_destroy(struct wayland *wayl) zwp_text_input_manager_v3_destroy(wayl->text_input_manager); #endif +#if defined(HAVE_XDG_SYSTEM_BELL) + if (wayl->system_bell != NULL) + xdg_system_bell_v1_destroy(wayl->system_bell); +#endif #if defined(HAVE_XDG_TOPLEVEL_ICON) if (wayl->toplevel_icon_manager != NULL) xdg_toplevel_icon_manager_v1_destroy(wayl->toplevel_icon_manager); @@ -2248,6 +2263,28 @@ wayl_win_set_urgent(struct wl_window *win) } bool +wayl_win_ring_bell(const struct wl_window *win) +{ +#if defined(HAVE_XDG_SYSTEM_BELL) + if (win->term->wl->system_bell == NULL) { + static bool have_warned = false; + + if (!have_warned) { + LOG_WARN("compositor does not implement the XDG system bell protocol"); + have_warned = true; + } + + return false; + } + + xdg_system_bell_v1_ring(win->term->wl->system_bell, win->surface.surf); + return true; +#else + return false; +#endif +} + +bool wayl_win_csd_titlebar_visible(const struct wl_window *win) { return win->csd_mode == CSD_YES && |
