aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-12-17 18:11:27 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-12-17 18:14:55 +0000
commit418ff5bcd925fb67cca83e899edaf8448da1e5bd (patch)
tree5def74ce589677398fca6fb5aa78b35770674a27 /render.c
parentcompletions: zsh: footclient: auto-complete files for -s,--server-socket (diff)
render: move blink timer handling to term.c
Diffstat (limited to 'render.c')
-rw-r--r--render.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/render.c b/render.c
index 7a03778d..f8b263a0 100644
--- a/render.c
+++ b/render.c
@@ -169,21 +169,6 @@ coord_is_selected(const struct terminal *term, int col, int row)
}
}
-static void
-arm_blink_timer(struct terminal *term)
-{
- LOG_DBG("arming blink timer");
- struct itimerspec alarm = {
- .it_value = {.tv_sec = 0, .tv_nsec = 500 * 1000000},
- .it_interval = {.tv_sec = 0, .tv_nsec = 500 * 1000000},
- };
-
- if (timerfd_settime(term->blink.fd, 0, &alarm, NULL) < 0)
- LOG_ERRNO("failed to arm blink timer");
- else
- term->blink.active = true;
-}
-
static int
render_cell(struct terminal *term, pixman_image_t *pix,
struct cell *cell, int col, int row, bool has_cursor)
@@ -292,10 +277,8 @@ render_cell(struct terminal *term, pixman_image_t *pix,
}
}
- if (cell->attrs.blink && !term->blink.active) {
- /* First cell we see that has blink set - arm blink timer */
- arm_blink_timer(term);
- }
+ if (cell->attrs.blink)
+ term_arm_blink_timer(term);
if (cell->wc == 0 || cell->attrs.conceal)
return cell_cols;
@@ -638,35 +621,6 @@ grid_render(struct terminal *term)
}
}
- if (term->blink.active) {
- /* Check if there are still any visible blinking cells */
- bool none_is_blinking = true;
- for (int r = 0; r < term->rows; r++) {
- struct row *row = grid_row_in_view(term->grid, r);
- for (int col = 0; col < term->cols; col++) {
- if (row->cells[col].attrs.blink) {
- none_is_blinking = false;
- break;
- }
- }
- }
-
- /* No, disarm the blink timer */
- if (none_is_blinking) {
- LOG_DBG("disarming blink timer");
-
- term->blink.active = false;
- term->blink.state = BLINK_ON;
-
- if (timerfd_settime(
- term->blink.fd, 0,
- &(struct itimerspec){{0}}, NULL) < 0)
- {
- LOG_ERRNO("failed to disarm blink timer");
- }
- }
- }
-
/*
* Determine if we need to render a cursor or not. The cursor
* could be hidden. Or it could have been scrolled out of view.
@@ -710,7 +664,6 @@ grid_render(struct terminal *term)
cell->attrs.clean = 0;
term->render.last_cursor.cell = cell;
- term->render.last_cursor.blink_state = term->cursor_blink.state;
int cols_updated = render_cell(
term, pix, cell, term->cursor.point.col, view_aligned_row, true);