mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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.
This commit is contained in:
parent
5ef55a7f52
commit
b2935e2b89
3 changed files with 27 additions and 0 deletions
24
render.c
24
render.c
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
2
render.h
2
render.h
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue