From 7b27fa857f74a884925f3b94b8604313f732a635 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 12 Jan 2020 12:21:31 +0100 Subject: dcs: bsu/esu: call render_{disable,enable}_refresh() --- dcs.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'dcs.c') diff --git a/dcs.c b/dcs.c index 40d9a8b0..f8354e88 100644 --- a/dcs.c +++ b/dcs.c @@ -3,22 +3,24 @@ #define LOG_MODULE "dcs" #define LOG_ENABLE_DBG 0 #include "log.h" +#include "render.h" #include "vt.h" static void bsu(struct terminal *term) { - LOG_WARN("unimplemented: BSU - Begin Synchronized Update (params: %.*s)", - (int)term->vt.dcs.idx, term->vt.dcs.data); - abort(); + LOG_DBG("BSU - Begin Synchronized Update (params: %.*s)", + (int)term->vt.dcs.idx, term->vt.dcs.data); + + render_disable_refresh(term); } static void esu(struct terminal *term) { - LOG_WARN("unimplemented: ESU - Begin Synchronized Update (params: %.*s)", - (int)term->vt.dcs.idx, term->vt.dcs.data); - abort(); + LOG_DBG("ESU - Begin Synchronized Update (params: %.*s)", + (int)term->vt.dcs.idx, term->vt.dcs.data); + render_enable_refresh(term); } void -- cgit v1.3 From 6e474e77e50510d825bc6bf8fd60fad17b66a40d Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 12 Jan 2020 12:28:00 +0100 Subject: render: rename render_{enable,disable}_refresh() --- dcs.c | 5 +++-- render.c | 6 +++--- render.h | 5 +++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'dcs.c') diff --git a/dcs.c b/dcs.c index f8354e88..b0ff50ed 100644 --- a/dcs.c +++ b/dcs.c @@ -12,7 +12,7 @@ bsu(struct terminal *term) LOG_DBG("BSU - Begin Synchronized Update (params: %.*s)", (int)term->vt.dcs.idx, term->vt.dcs.data); - render_disable_refresh(term); + render_enable_application_synchronized_updates(term); } static void @@ -20,7 +20,8 @@ esu(struct terminal *term) { LOG_DBG("ESU - Begin Synchronized Update (params: %.*s)", (int)term->vt.dcs.idx, term->vt.dcs.data); - render_enable_refresh(term); + + render_disable_application_synchronized_updates(term); } void diff --git a/render.c b/render.c index f7841d8d..7024a50e 100644 --- a/render.c +++ b/render.c @@ -1016,7 +1016,7 @@ render_resize(struct terminal *term, int width, int height) return; /* Cancel an application initiated "Synchronized Update" */ - render_enable_refresh(term); + render_disable_application_synchronized_updates(term); term->width = width; term->height = height; @@ -1242,7 +1242,7 @@ render_refresh(struct terminal *term) } void -render_disable_refresh(struct terminal *term) +render_enable_application_synchronized_updates(struct terminal *term) { if (term->render.application_synchronized_updates) return; @@ -1251,7 +1251,7 @@ render_disable_refresh(struct terminal *term) } void -render_enable_refresh(struct terminal *term) +render_disable_application_synchronized_updates(struct terminal *term) { if (!term->render.application_synchronized_updates) return; diff --git a/render.h b/render.h index 59bae895..6a2ddafa 100644 --- a/render.h +++ b/render.h @@ -11,12 +11,13 @@ 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); +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; -- cgit v1.3 From bdf127fc7e26585cfddc73193751996033bbe88c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 12 Jan 2020 12:43:28 +0100 Subject: term/render: move {enable,disable}_application_synchronized_updates() From render -> terminal --- dcs.c | 5 ++--- render.c | 32 +------------------------------- render.h | 3 --- terminal.c | 32 +++++++++++++++++++++++++++++++- terminal.h | 3 +++ 5 files changed, 37 insertions(+), 38 deletions(-) (limited to 'dcs.c') diff --git a/dcs.c b/dcs.c index b0ff50ed..73a371c0 100644 --- a/dcs.c +++ b/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 diff --git a/render.c b/render.c index 98b208df..ae623940 100644 --- a/render.c +++ b/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) { diff --git a/render.h b/render.h index 6a2ddafa..43f5314e 100644 --- a/render.h +++ b/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; diff --git a/terminal.c b/terminal.c index a0467f85..af2d7109 100644 --- a/terminal.c +++ b/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); +} diff --git a/terminal.h b/terminal.h index 9bb335dd..f30352ae 100644 --- a/terminal.h +++ b/terminal.h @@ -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); -- cgit v1.3