mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-20 05:33:47 -04: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)
|
if (width == term->width && height == term->height && scale == term->scale)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Cancel an application initiated "Synchronized Update" */
|
||||||
|
render_enable_refresh(term);
|
||||||
|
|
||||||
term->width = width;
|
term->width = width;
|
||||||
term->height = height;
|
term->height = height;
|
||||||
term->scale = scale;
|
term->scale = scale;
|
||||||
|
|
@ -1190,6 +1193,9 @@ fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data)
|
||||||
if (!term->render.refresh_needed)
|
if (!term->render.refresh_needed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (term->render.refresh_prohibited)
|
||||||
|
continue;
|
||||||
|
|
||||||
assert(term->window->is_configured);
|
assert(term->window->is_configured);
|
||||||
term->render.refresh_needed = false;
|
term->render.refresh_needed = false;
|
||||||
|
|
||||||
|
|
@ -1235,6 +1241,24 @@ render_refresh(struct terminal *term)
|
||||||
term->render.refresh_needed = true;
|
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
|
bool
|
||||||
render_xcursor_set(struct terminal *term)
|
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_resize(struct terminal *term, int width, int height);
|
||||||
void render_set_title(struct terminal *term, const char *title);
|
void render_set_title(struct terminal *term, const char *title);
|
||||||
void render_refresh(struct terminal *term);
|
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);
|
bool render_xcursor_set(struct terminal *term);
|
||||||
|
|
||||||
void render_search_box(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 */
|
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?) */
|
int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */
|
||||||
|
|
||||||
|
bool refresh_prohibited;
|
||||||
/* Render threads + synchronization primitives */
|
/* Render threads + synchronization primitives */
|
||||||
struct {
|
struct {
|
||||||
size_t count;
|
size_t count;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue