aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-09-29 17:38:56 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-09-29 17:38:56 +0000
commit70f12741716757631810dc52ffa5d7fab8efbaaf (patch)
tree2b3420dce520faecf5ce72d1d410237028e4b2ca
parentMerge branch 'allow-mouse-binding-click-count-less-than' into master (diff)
parentchangelog: fixed color flashes with OSC 4,10,11 (diff)
Merge branch 'osc4-refresh-scheduling' into master
Closes #141
-rw-r--r--CHANGELOG.md2
-rw-r--r--osc.c14
-rw-r--r--render.c28
-rw-r--r--render.h1
-rw-r--r--terminal.c13
-rw-r--r--terminal.h7
6 files changed, 32 insertions, 33 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3fbc2cc0..ca17ca4a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,6 +25,8 @@
than specified in the binding. This allows you to, for example,
quickly press the middle-button to paste multiple times
(https://codeberg.org/dnkl/foot/issues/146).
+* Color flashes when changing the color palette with OSC 4,10,11
+ (https://codeberg.org/dnkl/foot/issues/141).
### Security
diff --git a/osc.c b/osc.c
index 7e22d7c1..384cf401 100644
--- a/osc.c
+++ b/osc.c
@@ -589,7 +589,6 @@ osc_dispatch(struct terminal *term)
}
}
- render_refresh(term);
break;
}
@@ -635,8 +634,7 @@ osc_dispatch(struct terminal *term)
}
term_damage_view(term);
- render_refresh(term);
- render_refresh_margins(term);
+ term_damage_margins(term);
break;
}
@@ -664,7 +662,8 @@ osc_dispatch(struct terminal *term)
term->cursor_color.cursor = 0; /* Invert fg/bg */
else
term->cursor_color.cursor = 1u << 31 | color;
- render_refresh(term);
+
+ term_damage_cursor(term);
break;
case 30: /* Set tab title */
@@ -705,7 +704,6 @@ osc_dispatch(struct terminal *term)
}
}
- render_refresh(term);
break;
}
@@ -716,22 +714,20 @@ osc_dispatch(struct terminal *term)
LOG_DBG("resetting foreground");
term->colors.fg = term->colors.default_fg;
term_damage_view(term);
- render_refresh(term);
break;
case 111: /* Reset default text background color */
LOG_DBG("resetting background");
term->colors.bg = term->colors.default_bg;
term_damage_view(term);
- render_refresh(term);
- render_refresh_margins(term);
+ term_damage_margins(term);
break;
case 112:
LOG_DBG("resetting cursor color");
term->cursor_color.text = term->default_cursor_color.text;
term->cursor_color.cursor = term->default_cursor_color.cursor;
- render_refresh(term);
+ term_damage_cursor(term);
break;
case 555:
diff --git a/render.c b/render.c
index 43bcf5eb..210eaf47 100644
--- a/render.c
+++ b/render.c
@@ -1568,7 +1568,7 @@ static const struct wl_callback_listener frame_listener = {
};
static void
-grid_render(struct terminal *term, bool redraw_margins)
+grid_render(struct terminal *term)
{
if (term->is_shutting_down)
return;
@@ -1588,7 +1588,7 @@ grid_render(struct terminal *term, bool redraw_margins)
if (term->render.last_buf != buf ||
term->flash.active || term->render.was_flashing ||
term->is_searching != term->render.was_searching ||
- redraw_margins)
+ term->render.margins)
{
if (term->render.last_buf != NULL &&
term->render.last_buf->width == buf->width &&
@@ -1596,7 +1596,7 @@ grid_render(struct terminal *term, bool redraw_margins)
!term->flash.active &&
!term->render.was_flashing &&
term->is_searching == term->render.was_searching &&
- !redraw_margins)
+ !term->render.margins)
{
static bool has_warned = false;
if (!has_warned) {
@@ -1972,13 +1972,11 @@ frame_callback(void *data, struct wl_callback *wl_callback, uint32_t callback_da
term->window->frame_callback = NULL;
bool grid = term->render.pending.grid;
- bool margins = term->render.pending.margins;
bool csd = term->render.pending.csd;
bool search = term->render.pending.search;
bool title = term->render.pending.title;
term->render.pending.grid = false;
- term->render.pending.margins = false;
term->render.pending.csd = false;
term->render.pending.search = false;
term->render.pending.title = false;
@@ -1995,11 +1993,8 @@ frame_callback(void *data, struct wl_callback *wl_callback, uint32_t callback_da
if (search && term->is_searching)
render_search_box(term);
- if ((grid || margins) &&
- (!term->delayed_render_timer.is_armed || csd || search))
- {
- grid_render(term, margins);
- }
+ if (grid && (!term->delayed_render_timer.is_armed || csd || search))
+ grid_render(term);
}
/* Move to terminal.c? */
@@ -2336,13 +2331,11 @@ fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data)
assert(term->window->is_configured);
bool grid = term->render.refresh.grid;
- bool margins = term->render.refresh.margins;
bool csd = term->render.refresh.csd;
bool search = term->render.refresh.search;
bool title = term->render.refresh.title;
term->render.refresh.grid = false;
- term->render.refresh.margins = false;
term->render.refresh.csd = false;
term->render.refresh.search = false;
term->render.refresh.title = false;
@@ -2357,12 +2350,11 @@ fdm_hook_refresh_pending_terminals(struct fdm *fdm, void *data)
render_update_title(term);
if (search)
render_search_box(term);
- if (grid || margins)
- grid_render(term, margins);
+ if (grid)
+ grid_render(term);
} else {
/* Tells the frame callback to render again */
term->render.pending.grid |= grid;
- term->render.pending.margins |= margins;
term->render.pending.csd |= csd;
term->render.pending.search |= search;
term->render.pending.title |= title;
@@ -2394,12 +2386,6 @@ render_refresh(struct terminal *term)
}
void
-render_refresh_margins(struct terminal *term)
-{
- term->render.refresh.margins = true;
-}
-
-void
render_refresh_csd(struct terminal *term)
{
if (term->window->use_csd == CSD_YES)
diff --git a/render.h b/render.h
index 3f8cf540..05c79322 100644
--- a/render.h
+++ b/render.h
@@ -13,7 +13,6 @@ bool render_resize(struct terminal *term, int width, int height);
bool render_resize_force(struct terminal *term, int width, int height);
void render_refresh(struct terminal *term);
-void render_refresh_margins(struct terminal *term);
void render_refresh_csd(struct terminal *term);
void render_refresh_search(struct terminal *term);
void render_refresh_title(struct terminal *term);
diff --git a/terminal.c b/terminal.c
index 5e0dc65a..0840a45c 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1627,6 +1627,19 @@ term_damage_view(struct terminal *term)
}
void
+term_damage_cursor(struct terminal *term)
+{
+ term->grid->cur_row->cells[term->grid->cursor.point.col].attrs.clean = 0;
+ term->grid->cur_row->dirty = true;
+}
+
+void
+term_damage_margins(struct terminal *term)
+{
+ term->render.margins = true;
+}
+
+void
term_damage_scroll(struct terminal *term, enum damage_type damage_type,
struct scroll_region region, int lines)
{
diff --git a/terminal.h b/terminal.h
index 12e93ce2..60a4aba4 100644
--- a/terminal.h
+++ b/terminal.h
@@ -373,7 +373,6 @@ struct terminal {
/* Scheduled for rendering, as soon-as-possible */
struct {
bool grid;
- bool margins;
bool csd;
bool search;
bool title;
@@ -382,12 +381,13 @@ struct terminal {
/* Scheduled for rendering, in the next frame callback */
struct {
bool grid;
- bool margins;
bool csd;
bool search;
bool title;
} pending;
+ bool margins; /* Someone explicitly requested a refresh of the margins */
+
int scrollback_lines; /* Number of scrollback lines, from conf (TODO: move out from render struct?) */
struct {
@@ -512,6 +512,9 @@ void term_damage_rows_in_view(struct terminal *term, int start, int end);
void term_damage_all(struct terminal *term);
void term_damage_view(struct terminal *term);
+void term_damage_cursor(struct terminal *term);
+void term_damage_margins(struct terminal *term);
+
void term_reset_view(struct terminal *term);
void term_damage_scroll(