mirror of
https://github.com/tmux/tmux.git
synced 2025-04-01 21:41:44 +00:00
Set a PANE_STYLECHANGED flag for when a style update has to be sent.
This commit is contained in:
parent
e536f48d0e
commit
b32b596531
@ -99,7 +99,7 @@ cmd_break_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
|
||||
w = wp->window = window_create(w->sx, w->sy, w->xpixel, w->ypixel);
|
||||
options_set_parent(wp->options, w->options);
|
||||
wp->flags |= PANE_STYLECHANGED;
|
||||
wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
TAILQ_INSERT_HEAD(&w->panes, wp, entry);
|
||||
w->active = wp;
|
||||
w->latest = tc;
|
||||
|
@ -149,7 +149,7 @@ cmd_join_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
|
||||
src_wp->window = dst_w;
|
||||
options_set_parent(src_wp->options, dst_w->options);
|
||||
src_wp->flags |= PANE_STYLECHANGED;
|
||||
src_wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
if (flags & SPAWN_BEFORE)
|
||||
TAILQ_INSERT_BEFORE(dst_wp, src_wp, entry);
|
||||
else
|
||||
|
@ -149,12 +149,12 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
markedwp = marked_pane.wp;
|
||||
|
||||
if (lastwp != NULL) {
|
||||
lastwp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);
|
||||
lastwp->flags |= (PANE_REDRAW|PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
server_redraw_window_borders(lastwp->window);
|
||||
server_status_window(lastwp->window);
|
||||
}
|
||||
if (markedwp != NULL) {
|
||||
markedwp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);
|
||||
markedwp->flags |= (PANE_REDRAW|PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
server_redraw_window_borders(markedwp->window);
|
||||
server_status_window(markedwp->window);
|
||||
}
|
||||
@ -169,7 +169,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
options_set_string(oo, "window-active-style", 0, "%s", style);
|
||||
wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED);
|
||||
wp->flags |= (PANE_REDRAW|PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
}
|
||||
if (args_has(args, 'g')) {
|
||||
cmdq_print(item, "%s", options_get_string(oo, "window-style"));
|
||||
|
@ -217,7 +217,7 @@ cmd_send_keys_exec(struct cmd *self, struct cmdq_item *item)
|
||||
if (args_has(args, 'R')) {
|
||||
colour_palette_clear(&wp->palette);
|
||||
input_reset(wp->ictx, 1);
|
||||
wp->flags |= (PANE_STYLECHANGED|PANE_REDRAW);
|
||||
wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED|PANE_REDRAW);
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
|
@ -101,10 +101,10 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
|
||||
src_wp->window = dst_w;
|
||||
options_set_parent(src_wp->options, dst_w->options);
|
||||
src_wp->flags |= PANE_STYLECHANGED;
|
||||
src_wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
dst_wp->window = src_w;
|
||||
options_set_parent(dst_wp->options, src_w->options);
|
||||
dst_wp->flags |= PANE_STYLECHANGED;
|
||||
dst_wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
|
||||
sx = src_wp->sx; sy = src_wp->sy;
|
||||
xoff = src_wp->xoff; yoff = src_wp->yoff;
|
||||
|
4
input.c
4
input.c
@ -2795,7 +2795,7 @@ input_osc_11(struct input_ctx *ictx, const char *p)
|
||||
if (ictx->palette != NULL) {
|
||||
ictx->palette->bg = c;
|
||||
if (wp != NULL)
|
||||
wp->flags |= PANE_STYLECHANGED;
|
||||
wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
screen_write_fullredraw(&ictx->ctx);
|
||||
}
|
||||
}
|
||||
@ -2811,7 +2811,7 @@ input_osc_111(struct input_ctx *ictx, const char *p)
|
||||
if (ictx->palette != NULL) {
|
||||
ictx->palette->bg = 8;
|
||||
if (wp != NULL)
|
||||
wp->flags |= PANE_STYLECHANGED;
|
||||
wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
screen_write_fullredraw(&ictx->ctx);
|
||||
}
|
||||
}
|
||||
|
@ -1165,7 +1165,7 @@ options_push_changes(const char *name)
|
||||
if (strcmp(name, "window-style") == 0 ||
|
||||
strcmp(name, "window-active-style") == 0) {
|
||||
RB_FOREACH(wp, window_pane_tree, &all_window_panes)
|
||||
wp->flags |= PANE_STYLECHANGED;
|
||||
wp->flags |= (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
}
|
||||
if (strcmp(name, "pane-colours") == 0) {
|
||||
RB_FOREACH(wp, window_pane_tree, &all_window_panes)
|
||||
|
@ -878,9 +878,6 @@ screen_redraw_draw_pane(struct screen_redraw_ctx *ctx, struct window_pane *wp)
|
||||
|
||||
log_debug("%s: %s @%u %%%u", __func__, c->name, w->id, wp->id);
|
||||
|
||||
if (wp->flags & PANE_STYLECHANGED)
|
||||
window_pane_send_theme_update(wp);
|
||||
|
||||
if (wp->xoff + wp->sx <= ctx->ox || wp->xoff >= ctx->ox + ctx->sx)
|
||||
return;
|
||||
if (ctx->statustop)
|
||||
|
@ -2684,6 +2684,13 @@ server_client_loop(void)
|
||||
}
|
||||
check_window_name(w);
|
||||
}
|
||||
|
||||
/* Send theme updates. */
|
||||
RB_FOREACH(w, windows, &windows) {
|
||||
TAILQ_FOREACH(wp, &w->panes, entry) {
|
||||
window_pane_send_theme_update(wp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if window needs to be resized. */
|
||||
|
5
tmux.h
5
tmux.h
@ -1159,8 +1159,9 @@ struct window_pane {
|
||||
#define PANE_STATUSDRAWN 0x400
|
||||
#define PANE_EMPTY 0x800
|
||||
#define PANE_STYLECHANGED 0x1000
|
||||
#define PANE_UNSEENCHANGES 0x2000
|
||||
#define PANE_REDRAWSCROLLBAR 0x4000
|
||||
#define PANE_THEMECHANGED 0x2000
|
||||
#define PANE_UNSEENCHANGES 0x4000
|
||||
#define PANE_REDRAWSCROLLBAR 0x8000
|
||||
|
||||
u_int sb_slider_y;
|
||||
u_int sb_slider_h;
|
||||
|
12
tty-keys.c
12
tty-keys.c
@ -59,7 +59,7 @@ static int tty_keys_device_attributes2(struct tty *, const char *, size_t,
|
||||
size_t *);
|
||||
static int tty_keys_extended_device_attributes(struct tty *, const char *,
|
||||
size_t, size_t *);
|
||||
static void tty_keys_send_theme_updates(struct tty *);
|
||||
static void tty_keys_theme_changed(struct tty *);
|
||||
|
||||
/* A key tree entry. */
|
||||
struct tty_key {
|
||||
@ -796,12 +796,12 @@ tty_keys_next(struct tty *tty)
|
||||
switch (tty_keys_colours(tty, buf, len, &size, &tty->fg, &tty->bg)) {
|
||||
case 0: /* yes */
|
||||
key = KEYC_UNKNOWN;
|
||||
tty_keys_send_theme_updates(tty);
|
||||
tty_keys_theme_changed(tty);
|
||||
goto complete_key;
|
||||
case -1: /* no, or not valid */
|
||||
break;
|
||||
case 1: /* partial */
|
||||
tty_keys_send_theme_updates(tty);
|
||||
tty_keys_theme_changed(tty);
|
||||
goto partial_key;
|
||||
}
|
||||
|
||||
@ -1687,15 +1687,15 @@ tty_keys_colours(struct tty *tty, const char *buf, size_t len, size_t *size,
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Update theme in every pane for client's session. */
|
||||
/* Set the PANE_THEMECHANGED flag for every pane for client's session. */
|
||||
static void
|
||||
tty_keys_send_theme_updates(struct tty *tty)
|
||||
tty_keys_theme_changed(struct tty *tty)
|
||||
{
|
||||
struct window_pane *wp;
|
||||
struct winlink *wl;
|
||||
|
||||
RB_FOREACH(wl, winlinks, &tty->client->session->windows) {
|
||||
TAILQ_FOREACH(wp, &wl->window->panes, entry)
|
||||
window_pane_send_theme_update(wp);
|
||||
wp->flags |= PANE_THEMECHANGED;
|
||||
}
|
||||
}
|
||||
|
8
window.c
8
window.c
@ -950,7 +950,7 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
|
||||
wp = xcalloc(1, sizeof *wp);
|
||||
wp->window = w;
|
||||
wp->options = options_create(w->options);
|
||||
wp->flags = PANE_STYLECHANGED;
|
||||
wp->flags = (PANE_STYLECHANGED|PANE_THEMECHANGED);
|
||||
|
||||
wp->id = next_window_pane_id++;
|
||||
RB_INSERT(window_pane_tree, &all_window_panes, wp);
|
||||
@ -1897,8 +1897,12 @@ window_pane_get_theme(struct window_pane *wp)
|
||||
void
|
||||
window_pane_send_theme_update(struct window_pane *wp)
|
||||
{
|
||||
if (~wp->flags & PANE_THEMECHANGED)
|
||||
return;
|
||||
|
||||
if (~wp->screen->mode & MODE_THEME_UPDATES)
|
||||
return;
|
||||
|
||||
switch (window_pane_get_theme(wp)) {
|
||||
case THEME_LIGHT:
|
||||
input_key_pane(wp, KEYC_REPORT_LIGHT_THEME, NULL);
|
||||
@ -1909,4 +1913,6 @@ window_pane_send_theme_update(struct window_pane *wp)
|
||||
case THEME_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
|
||||
wp->flags &= ~PANE_THEMECHANGED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user