version 1.233, 2019/06/18 11:08:42 |
version 1.234, 2019/06/20 11:59:59 |
|
|
|
|
w = xcalloc(1, sizeof *w); |
w = xcalloc(1, sizeof *w); |
w->name = NULL; |
w->name = NULL; |
w->flags = WINDOW_STYLECHANGED; |
w->flags = 0; |
|
|
TAILQ_INIT(&w->panes); |
TAILQ_INIT(&w->panes); |
w->active = NULL; |
w->active = NULL; |
|
|
void |
void |
window_redraw_active_switch(struct window *w, struct window_pane *wp) |
window_redraw_active_switch(struct window *w, struct window_pane *wp) |
{ |
{ |
struct style *sy; |
struct style *sy1, *sy2; |
|
int c1, c2; |
|
|
if (wp == w->active) |
if (wp == w->active) |
return; |
return; |
|
|
/* |
for (;;) { |
* If window-style and window-active-style are the same, we don't need |
/* |
* to redraw panes when switching active panes. |
* If the active and inactive styles or palettes are different, |
*/ |
* need to redraw the panes. |
sy = options_get_style(w->options, "window-active-style"); |
*/ |
if (style_equal(sy, options_get_style(w->options, "window-style"))) |
sy1 = &wp->cached_style; |
return; |
sy2 = &wp->cached_active_style; |
|
if (!style_equal(sy1, sy2)) |
/* |
wp->flags |= PANE_REDRAW; |
* If the now active or inactive pane do not have a custom style or if |
else { |
* the palette is different, they need to be redrawn. |
c1 = window_pane_get_palette(wp, sy1->gc.fg); |
*/ |
c2 = window_pane_get_palette(wp, sy2->gc.fg); |
if (window_pane_get_palette(w->active, w->active->style.gc.fg) != -1 || |
if (c1 != c2) |
window_pane_get_palette(w->active, w->active->style.gc.bg) != -1 || |
wp->flags |= PANE_REDRAW; |
style_is_default(&w->active->style)) |
else { |
w->active->flags |= PANE_REDRAW; |
c1 = window_pane_get_palette(wp, sy1->gc.bg); |
if (window_pane_get_palette(wp, wp->style.gc.fg) != -1 || |
c2 = window_pane_get_palette(wp, sy2->gc.bg); |
window_pane_get_palette(wp, wp->style.gc.bg) != -1 || |
if (c1 != c2) |
style_is_default(&wp->style)) |
wp->flags |= PANE_REDRAW; |
wp->flags |= PANE_REDRAW; |
} |
|
} |
|
if (wp == w->active) |
|
break; |
|
wp = w->active; |
|
} |
} |
} |
|
|
struct window_pane * |
struct window_pane * |
|
|
|
|
wp = xcalloc(1, sizeof *wp); |
wp = xcalloc(1, sizeof *wp); |
wp->window = w; |
wp->window = w; |
|
wp->options = options_create(w->options); |
|
wp->flags = PANE_STYLECHANGED; |
|
|
wp->id = next_window_pane_id++; |
wp->id = next_window_pane_id++; |
RB_INSERT(window_pane_tree, &all_window_panes, wp); |
RB_INSERT(window_pane_tree, &all_window_panes, wp); |
|
|
wp->saved_cx = UINT_MAX; |
wp->saved_cx = UINT_MAX; |
wp->saved_cy = UINT_MAX; |
wp->saved_cy = UINT_MAX; |
|
|
style_set(&wp->style, &grid_default_cell); |
|
|
|
screen_init(&wp->base, sx, sy, hlimit); |
screen_init(&wp->base, sx, sy, hlimit); |
wp->screen = &wp->base; |
wp->screen = &wp->base; |
|
|
|
|
|
|
RB_REMOVE(window_pane_tree, &all_window_panes, wp); |
RB_REMOVE(window_pane_tree, &all_window_panes, wp); |
|
|
|
options_free(wp->options); |
free((void *)wp->cwd); |
free((void *)wp->cwd); |
free(wp->shell); |
free(wp->shell); |
cmd_free_argv(wp->argc, wp->argv); |
cmd_free_argv(wp->argc, wp->argv); |