diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2021-02-22 09:22:41 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2021-02-26 08:15:45 +0000 |
| commit | 54b5ae95c1bb01c5103b3ce97a8faebe75e142bb (patch) | |
| tree | 3cdb572a14b19366063a3d6d73d6ed8279bf5f4e /render.c | |
| parent | grid: add grid_snapshot() (diff) | |
url-mode: snapshot screen state when entering URL mode
Previously, we automatically exited URL mode whenever we received data
on the PTY. This was done since we don’t know _what_ has changed on
the screen, and we don’t want to display misleading jump labels.
However, this becomes a problem in curses-like applications that
periodically updates part of the screen. For example, a statusbar with
a clock.
This patch changes this behavior; instead of cancelling URL mode when
receiving PTY data, we snapshot the grid when entering URL mode.
When *rendering*, we use the snapshot:ed grid, while PTY updates
modify the “real” grid.
Snapshot:ing the grid means taking a full/deep copy of the current
grid, including sixel images etc.
Finally, it isn’t necessary to “damage” the entire view
when *entering* URL mode, since we’re at that point the renderer is in
sync with the grid. But we *do* need to damage the entire view when
exiting URL mode, since the grid changes on the “real” grid hasn’t
been tracked by the renderer.
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -2675,6 +2675,12 @@ frame_callback(void *data, struct wl_callback *wl_callback, uint32_t callback_da term->render.pending.title = false; term->render.pending.urls = false; + struct grid *original_grid = term->grid; + if (urls_mode_is_active(term)) { + xassert(term->url_grid_snapshot != NULL); + term->grid = term->url_grid_snapshot; + } + if (csd && term->window->use_csd == CSD_YES) { quirk_weston_csd_on(term); render_csd(term); @@ -2697,6 +2703,8 @@ frame_callback(void *data, struct wl_callback *wl_callback, uint32_t callback_da if (it->item.kbd_focus == term) ime_update_cursor_rect(&it->item, term); } + + term->grid = original_grid; } static void @@ -3127,6 +3135,12 @@ fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data) term->render.refresh.urls = false; if (term->window->frame_callback == NULL) { + struct grid *original_grid = term->grid; + if (urls_mode_is_active(term)) { + xassert(term->url_grid_snapshot != NULL); + term->grid = term->url_grid_snapshot; + } + if (csd && term->window->use_csd == CSD_YES) { quirk_weston_csd_on(term); render_csd(term); @@ -3145,6 +3159,8 @@ fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data) if (it->item.kbd_focus == term) ime_update_cursor_rect(&it->item, term); } + + term->grid = original_grid; } else { /* Tells the frame callback to render again */ term->render.pending.grid |= grid; |
