Some more trivial floating panes bits.

This commit is contained in:
nicm
2026-05-20 08:54:40 +00:00
parent ce24b92758
commit 572e26deb8
4 changed files with 19 additions and 10 deletions

View File

@@ -79,6 +79,12 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
if (src_wp == dst_wp) if (src_wp == dst_wp)
goto out; goto out;
if ((src_wp->flags & PANE_FLOATING) &&
(dst_wp->flags & PANE_FLOATING)) {
cmdq_error(item, "cannot swap floating panes");
return (CMD_RETURN_ERROR);
}
server_client_remove_pane(src_wp); server_client_remove_pane(src_wp);
server_client_remove_pane(dst_wp); server_client_remove_pane(dst_wp);
@@ -98,6 +104,10 @@ cmd_swap_pane_exec(struct cmd *self, struct cmdq_item *item)
dst_wp->layout_cell = src_lc; dst_wp->layout_cell = src_lc;
dst_lc->wp = src_wp; dst_lc->wp = src_wp;
src_wp->layout_cell = dst_lc; src_wp->layout_cell = dst_lc;
if ((src_wp->flags ^ dst_wp->flags) & PANE_FLOATING) {
src_wp->flags ^= PANE_FLOATING;
dst_wp->flags ^= PANE_FLOATING;
}
src_wp->window = dst_w; src_wp->window = dst_w;
options_set_parent(src_wp->options, dst_w->options); options_set_parent(src_wp->options, dst_w->options);

View File

@@ -336,7 +336,7 @@ layout_assign(struct window_pane **wp, struct layout_cell *lc, int flags)
case LAYOUT_TOPBOTTOM: case LAYOUT_TOPBOTTOM:
case LAYOUT_FLOATING: case LAYOUT_FLOATING:
TAILQ_FOREACH(lcchild, &lc->cells, entry) TAILQ_FOREACH(lcchild, &lc->cells, entry)
layout_assign(wp, lcchild, 1); layout_assign(wp, lcchild, PANE_FLOATING);
return; return;
} }
} }

View File

@@ -322,7 +322,7 @@ screen_redraw_type_of_cell(struct screen_redraw_ctx *ctx,
struct client *c = ctx->c; struct client *c = ctx->c;
struct window *w = c->session->curw->window; struct window *w = c->session->curw->window;
int pane_status = ctx->pane_status, borders = 0; int pane_status = ctx->pane_status, borders = 0;
int sx = w->sx, sy = w->sy;; int sx = w->sx, sy = w->sy;
/* Is this outside the window? */ /* Is this outside the window? */
if (pane_status == PANE_STATUS_BOTTOM) if (pane_status == PANE_STATUS_BOTTOM)
@@ -480,7 +480,6 @@ screen_redraw_check_cell(struct screen_redraw_ctx *ctx, int px, int py,
if (~wp->flags & PANE_FLOATING) if (~wp->flags & PANE_FLOATING)
tiled_only = 1; tiled_only = 1;
do { /* Loop until back to wp == start.*/ do { /* Loop until back to wp == start.*/
if (!window_pane_visible(wp) || if (!window_pane_visible(wp) ||
(tiled_only && (wp->flags & PANE_FLOATING))) (tiled_only && (wp->flags & PANE_FLOATING)))
goto next; goto next;