diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-01-12 11:19:38 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-01-12 11:19:38 +0000 |
| commit | b2935e2b89cf999d64a6322f58d6bf4307371463 (patch) | |
| tree | cb14da48fd160285c90e99c9b9e83f1d1ce61a28 | |
| parent | dcs: abort() in bsu/esu (diff) | |
render: add render_{enable,disable}_refresh()
Calling render_disable_refresh() causes update requests to that
terminal to be ignored.
Calling render_enable_refresh() re-enables updates.
| -rw-r--r-- | render.c | 24 | ||||
| -rw-r--r-- | render.h | 2 | ||||
| -rw-r--r-- | terminal.h | 1 |
3 files changed, 27 insertions, 0 deletions
@@ -1015,6 +1015,9 @@ render_resize(struct terminal *term, int width, int height) if (width == term->width && height == term->height && scale == term->scale) return; + /* Cancel an application initiated "Synchronized Update" */ + render_enable_refresh(term); + term->width = width; term->height = height; term->scale = scale; @@ -1190,6 +1193,9 @@ fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data) if (!term->render.refresh_needed) continue; + if (term->render.refresh_prohibited) + continue; + assert(term->window->is_configured); term->render.refresh_needed = false; @@ -1235,6 +1241,24 @@ render_refresh(struct terminal *term) term->render.refresh_needed = true; } +void +render_disable_refresh(struct terminal *term) +{ + if (term->render.refresh_prohibited) + return; + + term->render.refresh_prohibited = true; +} + +void +render_enable_refresh(struct terminal *term) +{ + if (!term->render.refresh_prohibited) + return; + + term->render.refresh_prohibited = false; +} + bool render_xcursor_set(struct terminal *term) { @@ -11,6 +11,8 @@ void render_destroy(struct renderer *renderer); void render_resize(struct terminal *term, int width, int height); void render_set_title(struct terminal *term, const char *title); void render_refresh(struct terminal *term); +void render_disable_refresh(struct terminal *term); +void render_enable_refresh(struct terminal *term); bool render_xcursor_set(struct terminal *term); void render_search_box(struct terminal *term); @@ -292,6 +292,7 @@ struct terminal { bool refresh_needed; /* Terminal needs to be re-rendered, as soon-as-possible */ int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */ + bool refresh_prohibited; /* Render threads + synchronization primitives */ struct { size_t count; |
