aboutsummaryrefslogtreecommitdiff
path: root/csi.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 /csi.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 'csi.c')
-rw-r--r--csi.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/csi.c b/csi.c
index 4bfa3957..fe65dbf1 100644
--- a/csi.c
+++ b/csi.c
@@ -569,6 +569,12 @@ decset_decrst(struct terminal *term, unsigned param, bool enable)
term->report_theme_changes = enable;
break;
+ case 2033:
+ term->visibility_reports = enable;
+ if (enable)
+ term_send_visibility_report(term);
+ break;
+
case 2048:
if (enable)
term_enable_size_notifications(term);
@@ -664,6 +670,7 @@ decrqm(const struct terminal *term, unsigned param)
? DECRPM_PERMANENTLY_RESET
: decrpm(term->grapheme_shaping);
case 2031: return decrpm(term->report_theme_changes);
+ case 2033: return decrpm(term->visibility_reports);
case 2048: return decrpm(term->size_notifications);
case 8452: return decrpm(term->sixel.cursor_right_of_graphics);
case 737769: return decrpm(term_ime_is_enabled(term));
@@ -710,6 +717,7 @@ xtsave(struct terminal *term, unsigned param)
case 2026: term->xtsave.app_sync_updates = term->render.app_sync_updates.enabled; break;
case 2027: term->xtsave.grapheme_shaping = term->grapheme_shaping; break;
case 2031: term->xtsave.report_theme_changes = term->report_theme_changes; break;
+ case 2033: term->xtsave.visibility_reports = term->visibility_reports; break;
case 2048: term->xtsave.size_notifications = term->size_notifications; break;
case 8452: term->xtsave.sixel_cursor_right_of_graphics = term->sixel.cursor_right_of_graphics; break;
case 737769: term->xtsave.ime = term_ime_is_enabled(term); break;
@@ -755,6 +763,7 @@ xtrestore(struct terminal *term, unsigned param)
case 2026: enable = term->xtsave.app_sync_updates; break;
case 2027: enable = term->xtsave.grapheme_shaping; break;
case 2031: enable = term->xtsave.report_theme_changes; break;
+ case 2033: enable = term->xtsave.visibility_reports; break;
case 2048: enable = term->xtsave.size_notifications; break;
case 8452: enable = term->xtsave.sixel_cursor_right_of_graphics; break;
case 737769: enable = term->xtsave.ime; break;
@@ -1590,6 +1599,10 @@ csi_dispatch(struct terminal *term, uint8_t final)
term_to_slave(term, reply, chars);
break;
}
+
+ case 998:
+ term_send_visibility_report(term);
+ break;
}
break;
}