Move the PANE_FLOATING flag into the layout cell and add an accessor.

From Dane Jensen.
This commit is contained in:
nicm
2026-06-02 08:13:50 +00:00
parent 35f4c8b333
commit ae6a749d3a
14 changed files with 69 additions and 52 deletions

View File

@@ -106,7 +106,7 @@ screen_redraw_two_panes(struct window *w, enum layout_type *type)
u_int count = 0;
TAILQ_FOREACH(wp, &w->panes, entry) {
if (wp->flags & PANE_FLOATING || wp->layout_cell == NULL)
if (window_pane_is_floating(wp) || wp->layout_cell == NULL)
continue;
count++;
if (count > 2 || wp->layout_cell->parent == NULL)
@@ -144,7 +144,7 @@ screen_redraw_pane_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
/* Floating pane borders. */
if (wp->flags & PANE_FLOATING) {
if (window_pane_is_floating(wp)) {
if (py >= wp->yoff - 1 && py <= wp->yoff + sy) {
if (sb_pos == PANE_SCROLLBARS_LEFT) {
if (px == wp->xoff - 1 - sb_w)
@@ -287,7 +287,7 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;
/* For floating panes, only check the pane itself. */
if (wp->flags & PANE_FLOATING) {
if (window_pane_is_floating(wp)) {
n = screen_redraw_cell_border1(ctx, sb_pos, sb_w, wp, px, py);
if (n == -1)
return (0);
@@ -309,7 +309,7 @@ screen_redraw_cell_border(struct screen_redraw_ctx *ctx, struct window_pane *wp,
* single z-index.
*/
TAILQ_FOREACH(wp2, &w->z_index, zentry) {
if (!window_pane_visible(wp2) || wp2->flags & PANE_FLOATING)
if (!window_pane_visible(wp2) || window_pane_is_floating(wp2))
continue;
n = screen_redraw_cell_border1(ctx, sb_pos, sb_w, wp2, px, py);
if (n != -1)
@@ -343,7 +343,7 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx,
* 8 + 4
* 1
*/
if (~wp->flags & PANE_FLOATING) {
if (!window_pane_is_floating(wp)) {
if (px == 0 || screen_redraw_cell_border(ctx, wp, px - 1, py))
borders |= 8;
if (px <= sx && screen_redraw_cell_border(ctx, wp, px + 1, py))
@@ -447,7 +447,7 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
/* Find pane highest in z-index at this point. */
TAILQ_FOREACH(wp, &w->z_index, zentry) {
if (wp->flags & PANE_FLOATING && (px >= sx || py >= sy)) {
if (window_pane_is_floating(wp) && (px >= sx || py >= sy)) {
/* Clip floating panes to window. */
continue;
}
@@ -482,12 +482,12 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
* necessary if there are two side-by-side or top-bottom panes with a
* shared border and half the shared border is the active border.
*/
if (~wp->flags & PANE_FLOATING)
if (!window_pane_is_floating(wp))
tiled_only = 1;
do { /* loop until back to wp == start */
if (!window_pane_visible(wp))
goto next;
if (tiled_only && (wp->flags & PANE_FLOATING))
if (tiled_only && window_pane_is_floating(wp))
goto next;
*wpp = wp;
@@ -882,8 +882,8 @@ screen_redraw_draw_borders_style(struct screen_redraw_ctx *ctx, u_int x,
struct format_tree *ft;
int *flag;
if ((wp->flags & PANE_FLOATING && wp == active) ||
(!(wp->flags & PANE_FLOATING) &&
if ((window_pane_is_floating(wp) && wp == active) ||
(!window_pane_is_floating(wp) &&
screen_redraw_check_is(ctx, x, y, active))) {
flag = &wp->active_border_gc_set;
gc = &wp->active_border_gc;
@@ -923,9 +923,9 @@ screen_redraw_draw_border_arrows(struct screen_redraw_ctx *ctx, int i,
return;
if (wp != active) {
if (active->flags & PANE_FLOATING)
if (window_pane_is_floating(active))
return;
if (wp->flags & PANE_FLOATING)
if (window_pane_is_floating(wp))
return;
}
@@ -1197,7 +1197,7 @@ screen_redraw_get_visible_ranges(struct window_pane *base_wp, int px,
(u_int)py < tb ||
(u_int)py > bb)
continue;
if (~wp->flags & PANE_FLOATING && (u_int)py == bb)
if (!window_pane_is_floating(wp) && (u_int)py == bb)
continue;
sb_w = wp->scrollbar_style.width + wp->scrollbar_style.pad;