aboutsummaryrefslogtreecommitdiff
path: root/wayland.c
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2026-07-28 19:16:05 +0000
committerDaniel Eklöf <daniel@ekloef.se>2026-07-30 12:18:58 +0000
commit8db88cceb758b5be23e7db1fe74a48102ab07dc0 (patch)
tree2741b009de1520e2203d4b6695073422c77df738 /wayland.c
parentchangelog: add missing bug reference (diff)
terminal: add visibility reports
Applications cannot infer whether their terminal view is observable from keyboard focus alone, so they may continue expensive rendering while the surface is hidden. Implement private mode 2033 and the one-shot visibility query. Report Wayland xdg_toplevel suspension as not visible and otherwise remain conservative by treating the terminal as potentially visible. Amp-Thread-ID: https://ampcode.com/threads/T-019fb2b7-f245-7124-a69a-1484812532bb Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'wayland.c')
-rw-r--r--wayland.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/wayland.c b/wayland.c
index 7f79d573..6e70c0bd 100644
--- a/wayland.c
+++ b/wayland.c
@@ -871,7 +871,7 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
bool is_constrained_bottom = false;
bool is_constrained_left = false;
bool is_constrained_right = false;
- bool is_suspended UNUSED = false;
+ bool is_suspended = false;
#if defined(LOG_ENABLE_DBG) && LOG_ENABLE_DBG
char state_str[2048];
@@ -951,6 +951,7 @@ xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel,
struct wl_window *win = data;
win->configure.is_activated = is_activated;
+ win->configure.is_suspended = is_suspended;
win->configure.is_fullscreen = is_fullscreen;
win->configure.is_maximized = is_maximized;
win->configure.is_resizing = is_resizing;
@@ -1078,6 +1079,7 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface,
bool wasnt_configured = !win->is_configured;
bool was_resizing = win->is_resizing;
bool was_fullscreen = win->is_fullscreen;
+ bool was_suspended = win->is_suspended;
bool csd_was_enabled = win->csd_mode == CSD_YES && !win->is_fullscreen;
int new_width = win->configure.width;
int new_height = win->configure.height;
@@ -1086,6 +1088,7 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface,
win->is_maximized = win->configure.is_maximized;
win->is_fullscreen = win->configure.is_fullscreen;
win->is_resizing = win->configure.is_resizing;
+ win->is_suspended = win->configure.is_suspended;
win->is_tiled_top = win->configure.is_tiled_top;
win->is_tiled_bottom = win->configure.is_tiled_bottom;
@@ -1148,6 +1151,9 @@ xdg_surface_configure(void *data, struct xdg_surface *xdg_surface,
else
term_visual_focus_out(term);
+ if (was_suspended != win->is_suspended && term->visibility_reports)
+ term_send_visibility_report(term);
+
/*
* Update opaque region if fullscreen state changed, also need to
* render, since we use different buffer types with and without