mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
Merge branch 'obsd-master'
This commit is contained in:
59
window.c
59
window.c
@ -447,24 +447,30 @@ window_set_active_pane(struct window *w, struct window_pane *wp)
|
||||
void
|
||||
window_redraw_active_switch(struct window *w, struct window_pane *wp)
|
||||
{
|
||||
const struct grid_cell *agc, *wgc;
|
||||
const struct grid_cell *gc;
|
||||
|
||||
if (wp == w->active)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If window-style and window-active-style are the same, we don't need
|
||||
* to redraw panes when switching active panes. Otherwise, if the
|
||||
* active or inactive pane do not have a custom style, they will need
|
||||
* to be redrawn.
|
||||
* to redraw panes when switching active panes.
|
||||
*/
|
||||
agc = options_get_style(w->options, "window-active-style");
|
||||
wgc = options_get_style(w->options, "window-style");
|
||||
if (style_equal(agc, wgc))
|
||||
gc = options_get_style(w->options, "window-active-style");
|
||||
if (style_equal(gc, options_get_style(w->options, "window-style")))
|
||||
return;
|
||||
if (style_equal(&grid_default_cell, &w->active->colgc))
|
||||
|
||||
/*
|
||||
* If the now active or inactive pane do not have a custom style or if
|
||||
* the palette is different, they need to be redrawn.
|
||||
*/
|
||||
if (WINDOW_PANE_PALETTE_HAS(w->active, w->active->colgc.fg) ||
|
||||
WINDOW_PANE_PALETTE_HAS(w->active, w->active->colgc.bg) ||
|
||||
style_equal(&grid_default_cell, &w->active->colgc))
|
||||
w->active->flags |= PANE_REDRAW;
|
||||
if (style_equal(&grid_default_cell, &wp->colgc))
|
||||
if (WINDOW_PANE_PALETTE_HAS(wp, wp->colgc.fg) ||
|
||||
WINDOW_PANE_PALETTE_HAS(wp, wp->colgc.bg) ||
|
||||
style_equal(&grid_default_cell, &wp->colgc))
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
@ -832,6 +838,7 @@ window_pane_destroy(struct window_pane *wp)
|
||||
free((void *)wp->cwd);
|
||||
free(wp->shell);
|
||||
cmd_free_argv(wp->argc, wp->argv);
|
||||
free(wp->palette);
|
||||
free(wp);
|
||||
}
|
||||
|
||||
@ -1107,6 +1114,40 @@ window_pane_alternate_off(struct window_pane *wp, struct grid_cell *gc,
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_set_palette(struct window_pane *wp, u_int n, int colour)
|
||||
{
|
||||
if (n > 0xff)
|
||||
return;
|
||||
|
||||
if (wp->palette == NULL)
|
||||
wp->palette = xcalloc(0x100, sizeof *wp->palette);
|
||||
|
||||
wp->palette[n] = colour;
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_unset_palette(struct window_pane *wp, u_int n)
|
||||
{
|
||||
if (n > 0xff || wp->palette == NULL)
|
||||
return;
|
||||
|
||||
wp->palette[n] = 0;
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
void
|
||||
window_pane_reset_palette(struct window_pane *wp)
|
||||
{
|
||||
if (wp->palette == NULL)
|
||||
return;
|
||||
|
||||
free(wp->palette);
|
||||
wp->palette = NULL;
|
||||
wp->flags |= PANE_REDRAW;
|
||||
}
|
||||
|
||||
static void
|
||||
window_pane_mode_timer(__unused int fd, __unused short events, void *arg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user