mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
term/render: move {enable,disable}_application_synchronized_updates()
From render -> terminal
This commit is contained in:
parent
afa1dbb7cc
commit
bdf127fc7e
5 changed files with 37 additions and 38 deletions
5
dcs.c
5
dcs.c
|
|
@ -3,7 +3,6 @@
|
|||
#define LOG_MODULE "dcs"
|
||||
#define LOG_ENABLE_DBG 0
|
||||
#include "log.h"
|
||||
#include "render.h"
|
||||
#include "vt.h"
|
||||
|
||||
static void
|
||||
|
|
@ -12,7 +11,7 @@ bsu(struct terminal *term)
|
|||
LOG_DBG("BSU - Begin Synchronized Update (params: %.*s)",
|
||||
(int)term->vt.dcs.idx, term->vt.dcs.data);
|
||||
|
||||
render_enable_application_synchronized_updates(term);
|
||||
term_enable_application_synchronized_updates(term);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -21,7 +20,7 @@ esu(struct terminal *term)
|
|||
LOG_DBG("ESU - Begin Synchronized Update (params: %.*s)",
|
||||
(int)term->vt.dcs.idx, term->vt.dcs.data);
|
||||
|
||||
render_disable_application_synchronized_updates(term);
|
||||
term_disable_application_synchronized_updates(term);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
32
render.c
32
render.c
|
|
@ -1016,7 +1016,7 @@ render_resize(struct terminal *term, int width, int height)
|
|||
return;
|
||||
|
||||
/* Cancel an application initiated "Synchronized Update" */
|
||||
render_disable_application_synchronized_updates(term);
|
||||
term_disable_application_synchronized_updates(term);
|
||||
|
||||
term->width = width;
|
||||
term->height = height;
|
||||
|
|
@ -1241,36 +1241,6 @@ render_refresh(struct terminal *term)
|
|||
term->render.refresh_needed = true;
|
||||
}
|
||||
|
||||
void
|
||||
render_enable_application_synchronized_updates(struct terminal *term)
|
||||
{
|
||||
if (term->render.application_synchronized_updates.enabled)
|
||||
return;
|
||||
|
||||
term->render.application_synchronized_updates.enabled = true;
|
||||
|
||||
if (timerfd_settime(
|
||||
term->render.application_synchronized_updates.timer_fd, 0,
|
||||
&(struct itimerspec){.it_value = {.tv_sec = 1}}, NULL) < 0)
|
||||
{
|
||||
LOG_ERR("failed to arm timer for application synchronized updates");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
render_disable_application_synchronized_updates(struct terminal *term)
|
||||
{
|
||||
if (!term->render.application_synchronized_updates.enabled)
|
||||
return;
|
||||
|
||||
term->render.application_synchronized_updates.enabled = false;
|
||||
|
||||
/* Reset timers */
|
||||
timerfd_settime(
|
||||
term->render.application_synchronized_updates.timer_fd, 0,
|
||||
&(struct itimerspec){{0}}, NULL);
|
||||
}
|
||||
|
||||
bool
|
||||
render_xcursor_set(struct terminal *term)
|
||||
{
|
||||
|
|
|
|||
3
render.h
3
render.h
|
|
@ -15,9 +15,6 @@ bool render_xcursor_set(struct terminal *term);
|
|||
|
||||
void render_search_box(struct terminal *term);
|
||||
|
||||
void render_enable_application_synchronized_updates(struct terminal *term);
|
||||
void render_disable_application_synchronized_updates(struct terminal *term);
|
||||
|
||||
struct render_worker_context {
|
||||
int my_id;
|
||||
struct terminal *term;
|
||||
|
|
|
|||
32
terminal.c
32
terminal.c
|
|
@ -443,7 +443,7 @@ fdm_application_synchronized_updates_timeout(
|
|||
return false;
|
||||
}
|
||||
|
||||
render_disable_application_synchronized_updates(term);
|
||||
term_disable_application_synchronized_updates(term);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1812,3 +1812,33 @@ term_spawn_new(const struct terminal *term)
|
|||
waitpid(pid, &result, 0);
|
||||
return WIFEXITED(result) && WEXITSTATUS(result) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
term_enable_application_synchronized_updates(struct terminal *term)
|
||||
{
|
||||
if (term->render.application_synchronized_updates.enabled)
|
||||
return;
|
||||
|
||||
term->render.application_synchronized_updates.enabled = true;
|
||||
|
||||
if (timerfd_settime(
|
||||
term->render.application_synchronized_updates.timer_fd, 0,
|
||||
&(struct itimerspec){.it_value = {.tv_sec = 1}}, NULL) < 0)
|
||||
{
|
||||
LOG_ERR("failed to arm timer for application synchronized updates");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
term_disable_application_synchronized_updates(struct terminal *term)
|
||||
{
|
||||
if (!term->render.application_synchronized_updates.enabled)
|
||||
return;
|
||||
|
||||
term->render.application_synchronized_updates.enabled = false;
|
||||
|
||||
/* Reset timers */
|
||||
timerfd_settime(
|
||||
term->render.application_synchronized_updates.timer_fd, 0,
|
||||
&(struct itimerspec){{0}}, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,3 +410,6 @@ void term_xcursor_update(struct terminal *term);
|
|||
void term_set_window_title(struct terminal *term, const char *title);
|
||||
void term_flash(struct terminal *term, unsigned duration_ms);
|
||||
bool term_spawn_new(const struct terminal *term);
|
||||
|
||||
void term_enable_application_synchronized_updates(struct terminal *term);
|
||||
void term_disable_application_synchronized_updates(struct terminal *term);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue