diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-07-22 17:17:57 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-07-22 17:17:57 +0000 |
| commit | 428b31f0713d69fe07ecde19eb103a8274a2f96a (patch) | |
| tree | d5798079ebfb08060f4067f56d35ece62b6535c2 /render.c | |
| parent | term: group 'flash' state together in a struct (diff) | |
term: group 'blink' state together in a struct
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -118,7 +118,7 @@ render_cell(struct terminal *term, struct buffer *buf, const struct cell *cell, _bg = swap; } - if (cell->attrs.blink && term->blink_mode == BLINK_OFF) + if (cell->attrs.blink && term->blink.state == BLINK_OFF) _fg = _bg; struct rgb fg = color_hex_to_rgb(_fg); @@ -132,7 +132,7 @@ render_cell(struct terminal *term, struct buffer *buf, const struct cell *cell, cairo_rectangle(buf->cairo, x, y, width, height); cairo_fill(buf->cairo); - if (cell->attrs.blink && !term->is_blinking) { + if (cell->attrs.blink && !term->blink.active) { /* First cell we see that has blink set - arm blink timer */ LOG_DBG("arming blink timer"); struct itimerspec alarm = { @@ -140,10 +140,10 @@ render_cell(struct terminal *term, struct buffer *buf, const struct cell *cell, .it_interval = {.tv_sec = 0, .tv_nsec = 500 * 1000000}, }; - if (timerfd_settime(term->blink_timer_fd, 0, &alarm, NULL) < 0) + if (timerfd_settime(term->blink.fd, 0, &alarm, NULL) < 0) LOG_ERRNO("failed to arm blink timer"); else - term->is_blinking = true; + term->blink.active = true; } if (cell->c[0] == '\0' || cell->attrs.conceal) @@ -389,7 +389,7 @@ grid_render(struct terminal *term) term->width, term->cell_height); } - if (term->is_blinking) { + 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++) { @@ -406,11 +406,11 @@ grid_render(struct terminal *term) if (none_is_blinking) { LOG_DBG("disarming blink timer"); - term->is_blinking = false; - term->blink_mode = BLINK_ON; + term->blink.active = false; + term->blink.state = BLINK_ON; if (timerfd_settime( - term->blink_timer_fd, 0, + term->blink.fd, 0, &(struct itimerspec){0}, NULL) < 0) { LOG_ERRNO("failed to disarm blink timer"); |
