diff --git a/cmd-tile-float-pane.c b/cmd-tile-float-pane.c index ec3d8f64..19dfa4fc 100644 --- a/cmd-tile-float-pane.c +++ b/cmd-tile-float-pane.c @@ -159,7 +159,7 @@ cmd_float_pane_exec(struct cmd *self, struct cmdq_item *item) u_int sx, sy; struct layout_cell *lc; - if (wp->flags & PANE_FLOATING) { + if (window_pane_is_floating(wp)) { cmdq_error(item, "pane is already floating"); return (CMD_RETURN_ERROR); } @@ -207,7 +207,7 @@ cmd_float_pane_exec(struct cmd *self, struct cmdq_item *item) lc->sy = sy; layout_make_leaf(lc, wp); /* sets wp->layout_cell = lc, lc->wp = wp */ - wp->flags |= PANE_FLOATING; + lc->flags |= LAYOUT_CELL_FLOATING; TAILQ_REMOVE(&w->z_index, wp, zentry); TAILQ_INSERT_HEAD(&w->z_index, wp, zentry); @@ -231,7 +231,7 @@ cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item) struct layout_cell *float_lc, *lc; int was_hidden; - if (!(wp->flags & PANE_FLOATING)) { + if (!window_pane_is_floating(wp)) { cmdq_error(item, "pane is not floating"); return (CMD_RETURN_ERROR); } @@ -275,12 +275,13 @@ cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item) * than becoming a disconnected root. */ target_wp = NULL; - if (w->active != NULL && !(w->active->flags & PANE_FLOATING) && + if (w->active != NULL && !window_pane_is_floating(w->active) && !(w->active->flags & PANE_HIDDEN)) target_wp = w->active; if (target_wp == NULL) { TAILQ_FOREACH(wpiter, &w->last_panes, sentry) { - if (!(wpiter->flags & (PANE_FLOATING|PANE_HIDDEN)) && + if (!(wpiter->flags & PANE_HIDDEN) && + !window_pane_is_floating(wpiter) && window_pane_visible(wpiter)) { target_wp = wpiter; break; @@ -289,7 +290,8 @@ cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item) } if (target_wp == NULL) { TAILQ_FOREACH(wpiter, &w->panes, entry) { - if (!(wpiter->flags & (PANE_FLOATING|PANE_HIDDEN)) && + if (!(wpiter->flags & PANE_HIDDEN) && + !window_pane_is_floating(wpiter) && window_pane_visible(wpiter)) { target_wp = wpiter; break; @@ -299,7 +301,7 @@ cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item) /* Fall back to any tiled pane (even hidden) to stay in the tree. */ if (target_wp == NULL) { TAILQ_FOREACH(wpiter, &w->panes, entry) { - if (!(wpiter->flags & PANE_FLOATING)) { + if (!window_pane_is_floating(wpiter)) { target_wp = wpiter; break; } @@ -344,7 +346,7 @@ cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item) if (was_hidden) wp->saved_layout_cell = wp->layout_cell; - wp->flags &= ~PANE_FLOATING; + lc->flags &= ~LAYOUT_CELL_FLOATING; TAILQ_REMOVE(&w->z_index, wp, zentry); TAILQ_INSERT_TAIL(&w->z_index, wp, zentry); diff --git a/layout.c b/layout.c index 84d98b0a..41b8fee2 100644 --- a/layout.c +++ b/layout.c @@ -611,8 +611,6 @@ layout_destroy_cell(struct window *w, struct layout_cell *lc, struct layout_cell **lcroot) { struct layout_cell *lcother, *lcparent; - int direction; - int is_hidden; /* * If no parent, this is either a floating pane or the last @@ -641,9 +639,6 @@ layout_destroy_cell(struct window *w, struct layout_cell *lc, TAILQ_REMOVE(&lcparent->cells, lc, entry); layout_free_cell(lc); - if (lcparent->type == LAYOUT_FLOATING) - return; - /* * In tiled layouts, if the parent now has one cell, remove * the parent from the tree and replace it by that cell. @@ -687,10 +682,8 @@ layout_hide_cell(struct window *w, struct layout_cell *lc) int direction; lcparent = lc->parent; - if (lcparent == NULL || - lcparent->type == LAYOUT_FLOATING) { + if (lcparent == NULL) return; - } /* Merge the space into the nearest non-hidden sibling. */ { @@ -730,7 +723,7 @@ layout_show_cell(struct window *w, struct layout_cell *lc) if (lc == NULL) return; lcparent = lc->parent; - if (lcparent == NULL || lcparent->type == LAYOUT_FLOATING) + if (lcparent == NULL) return; /* diff --git a/screen-redraw.c b/screen-redraw.c index 51c3cc78..c3ffe815 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -610,7 +610,7 @@ screen_redraw_make_pane_status(struct client *c, struct window_pane *wp, else border_option = "pane-border-style"; style_apply(&gc, wp->options, border_option, ft); - if (wp->flags & PANE_FLOATING) + if (window_pane_is_floating(wp)) style_add(&gc, wp->options, "floating-pane-border-style", ft); fmt = options_get_string(wp->options, "pane-border-format"); diff --git a/tty.c b/tty.c index 73207b90..c567238f 100644 --- a/tty.c +++ b/tty.c @@ -2233,7 +2233,7 @@ tty_sixelimage_draw(struct tty *tty, const struct tty_ctx *ctx, breaks[nb++] = ry; TAILQ_FOREACH(fp, &w->z_index, zentry) { - if (~fp->flags & PANE_FLOATING) + if (!window_pane_is_floating(fp)) continue; fp_tb = (int)((fp->yoff > 0) ? fp->yoff - 1 : 0); fp_bb1 = (int)fp->yoff + (int)fp->sy + 1; @@ -3186,12 +3186,12 @@ tty_style_changed(struct window_pane *wp) tty_window_default_style(&wp->cached_active_gc, wp); style_add(&wp->cached_active_gc, oo, "window-active-style", ft); - if (wp->flags & PANE_FLOATING) + if (window_pane_is_floating(wp)) style_add(&wp->cached_active_gc, oo, "floating-pane-style", ft); tty_window_default_style(&wp->cached_gc, wp); style_add(&wp->cached_gc, oo, "window-style", ft); - if (wp->flags & PANE_FLOATING) + if (window_pane_is_floating(wp)) style_add(&wp->cached_active_gc, oo, "floating-pane-style", ft); format_free(ft); diff --git a/window.c b/window.c index a99d5109..e0417ec9 100644 --- a/window.c +++ b/window.c @@ -730,7 +730,7 @@ window_zoom(struct window_pane *wp) wp1->flags &= ~PANE_HIDDEN; continue; } - if (wp1->flags & PANE_FLOATING) { + if (window_pane_is_floating(wp1)) { wp1->saved_flags |= (wp1->flags & PANE_HIDDEN); wp1->flags |= PANE_HIDDEN; continue; @@ -765,7 +765,7 @@ window_unzoom(struct window *w, int notify) w->saved_layout_root = NULL; TAILQ_FOREACH(wp, &w->z_index, zentry) { - if (wp->flags & PANE_FLOATING) { + if (window_pane_is_floating(wp)) { wp->flags &= ~PANE_HIDDEN | (wp->saved_flags & PANE_HIDDEN); continue; }