Bug fixes and adjustments from feedback.

This commit is contained in:
Dane Jensen
2026-06-14 19:46:10 -07:00
parent 5dad31b06e
commit e244be2540
5 changed files with 133 additions and 92 deletions

View File

@@ -89,7 +89,7 @@ cmd_float_pane_exec(struct cmd *self, struct cmdq_item *item)
} }
layout_remove_tile(w, lc); layout_remove_tile(w, lc);
layout_cell_floating_args(item, args, w, &sx, &sy, &ox, &oy, &cause); layout_cell_floating_args_parse(item, args, w, &sx, &sy, &ox, &oy, &cause);
if (cause != NULL) { if (cause != NULL) {
cmdq_error(item, "failed to float pane: %s", cause); cmdq_error(item, "failed to float pane: %s", cause);
free(cause); free(cause);
@@ -134,11 +134,12 @@ cmd_tile_pane_exec(struct cmd *self, struct cmdq_item *item)
} }
layout_save_size(lc); layout_save_size(lc);
if (layout_insert_tile(w, lc) == 0)
return (CMD_RETURN_ERROR);
lc->flags &= ~LAYOUT_CELL_FLOATING; lc->flags &= ~LAYOUT_CELL_FLOATING;
if (layout_insert_tile(w, lc) == 0) {
cmdq_error(item, "can't tile a pane that is already tiled");
return (CMD_RETURN_ERROR);
}
TAILQ_REMOVE(&w->z_index, wp, zentry); TAILQ_REMOVE(&w->z_index, wp, zentry);
TAILQ_INSERT_TAIL(&w->z_index, wp, zentry); TAILQ_INSERT_TAIL(&w->z_index, wp, zentry);

180
layout.c
View File

@@ -26,11 +26,18 @@
/* /*
* The window layout is a tree of cells each of which can be one of: a * The window layout is a tree of cells each of which can be one of: a
* left-right container for a list of cells, a top-bottom container for a list * left-right container for a list of cells, a top-bottom container for a list
* of cells, or a container for a window pane. * of cells, or a container for a window pane. 'Node' will be used to refer to
* a cell which contains a list of cells, and 'leaf' to refer to a cell that
* contains a window pane. A leaf is considered to be tiled if it is to be drawn
* as a part of the tiled layout. A 'neighbour' is a sibling that is also tiled.
* A cell's 'split' size refers to the side that is shortened when splitting it,
* determined by the parent's type.
* *
* Each window has a pointer to the root of its layout tree (containing its * Each window has a pointer to the root of its layout tree (containing its
* panes), every pane has a pointer back to the cell containing it, and each * panes), every pane has a pointer back to the cell containing it, and each
* cell a pointer to its parent cell. * cell a pointer to its parent cell. Every cell has a position in the root
* layout tree. This position is retained through cell state changes such as
* floating or hiding.
*/ */
static u_int layout_resize_check(struct window *, struct layout_cell *, static u_int layout_resize_check(struct window *, struct layout_cell *,
@@ -44,6 +51,7 @@ static u_int layout_new_pane_size(struct window *, u_int,
u_int); u_int);
static int layout_set_size_check(struct window *, struct layout_cell *, static int layout_set_size_check(struct window *, struct layout_cell *,
enum layout_type, int); enum layout_type, int);
static int layout_cell_has_tiled_child(struct layout_cell *);
static void layout_resize_child_cells(struct window *, static void layout_resize_child_cells(struct window *,
struct layout_cell *); struct layout_cell *);
@@ -266,7 +274,8 @@ layout_fix_offsets1(struct layout_cell *lc)
if (lc->type == LAYOUT_LEFTRIGHT) { if (lc->type == LAYOUT_LEFTRIGHT) {
xoff = lc->xoff; xoff = lc->xoff;
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (!layout_cell_is_tiled(lcchild)) if (!layout_cell_is_tiled(lcchild) &&
!layout_cell_has_tiled_child(lcchild))
continue; continue;
lcchild->xoff = xoff; lcchild->xoff = xoff;
lcchild->yoff = lc->yoff; lcchild->yoff = lc->yoff;
@@ -277,7 +286,8 @@ layout_fix_offsets1(struct layout_cell *lc)
} else { } else {
yoff = lc->yoff; yoff = lc->yoff;
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (!layout_cell_is_tiled(lcchild)) if (!layout_cell_is_tiled(lcchild) &&
!layout_cell_has_tiled_child(lcchild))
continue; continue;
lcchild->xoff = lc->xoff; lcchild->xoff = lc->xoff;
lcchild->yoff = yoff; lcchild->yoff = yoff;
@@ -306,18 +316,18 @@ layout_fix_offsets(struct window *w)
/* /*
* Not all cells are drawn within the tiled grid of a layout. This predicate * Not all cells are drawn within the tiled grid of a layout. This predicate
* isolates that logic. Nodes are considered tiled. * isolates that logic. Nodes are not considered tiled.
*/ */
int int
layout_cell_is_tiled(struct layout_cell *lc) layout_cell_is_tiled(struct layout_cell *lc)
{ {
int is_node, is_floating, is_hidden; int is_leaf, is_floating, is_hidden;
is_node = lc->type != LAYOUT_WINDOWPANE; is_leaf = lc->type == LAYOUT_WINDOWPANE;
is_floating = lc->flags & LAYOUT_CELL_FLOATING; is_floating = lc->flags & LAYOUT_CELL_FLOATING;
is_hidden = lc->flags & LAYOUT_CELL_HIDDEN; is_hidden = lc->flags & LAYOUT_CELL_HIDDEN;
return is_node || (!is_floating && !is_hidden); return is_leaf && !(is_floating || is_hidden);
} }
static int static int
@@ -325,11 +335,12 @@ layout_cell_has_tiled_child(struct layout_cell *lc)
{ {
struct layout_cell *lcchild; struct layout_cell *lcchild;
if (lc == NULL || lc->type == LAYOUT_WINDOWPANE) if (lc->type == LAYOUT_WINDOWPANE)
return (0); return (0);
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (layout_cell_is_tiled(lcchild)) if (layout_cell_is_tiled(lcchild) ||
layout_cell_has_tiled_child(lcchild))
return (1); return (1);
} }
return (0); return (0);
@@ -344,7 +355,8 @@ layout_cell_is_first_tiled(struct layout_cell *lc)
return (layout_cell_is_tiled(lc)); return (layout_cell_is_tiled(lc));
TAILQ_FOREACH(lcchild, &lcparent->cells, entry) { TAILQ_FOREACH(lcchild, &lcparent->cells, entry) {
if (layout_cell_is_tiled(lcchild)) if (layout_cell_is_tiled(lcchild) ||
layout_cell_has_tiled_child(lcchild))
break; break;
} }
@@ -355,7 +367,7 @@ layout_cell_is_first_tiled(struct layout_cell *lc)
static int static int
layout_cell_is_top(struct window *w, struct layout_cell *lc) layout_cell_is_top(struct window *w, struct layout_cell *lc)
{ {
struct layout_cell *next, *edge; struct layout_cell *next;
while (lc != w->layout_root) { while (lc != w->layout_root) {
next = lc->parent; next = lc->parent;
@@ -561,7 +573,8 @@ layout_resize_adjust(struct window *w, struct layout_cell *lc,
/* Child cell runs in a different direction. */ /* Child cell runs in a different direction. */
if (lc->type != type) { if (lc->type != type) {
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (!layout_cell_is_tiled(lcchild)) if (!layout_cell_is_tiled(lcchild) &&
!layout_cell_has_tiled_child(lcchild))
continue; continue;
layout_resize_adjust(w, lcchild, type, change); layout_resize_adjust(w, lcchild, type, change);
} }
@@ -569,7 +582,7 @@ layout_resize_adjust(struct window *w, struct layout_cell *lc,
} }
/* /*
* If a container doesn't have any tiled cells, there is nothing to do. * If a node doesn't contain any tiled cells, there is nothing to do.
*/ */
if (!layout_cell_has_tiled_child(lc)) if (!layout_cell_has_tiled_child(lc))
return; return;
@@ -582,7 +595,8 @@ layout_resize_adjust(struct window *w, struct layout_cell *lc,
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (change == 0) if (change == 0)
break; break;
if (!layout_cell_is_tiled(lcchild)) if (!layout_cell_is_tiled(lcchild) &&
!layout_cell_has_tiled_child(lcchild))
continue; continue;
if (change > 0) { if (change > 0) {
layout_resize_adjust(w, lcchild, type, 1); layout_resize_adjust(w, lcchild, type, 1);
@@ -599,7 +613,7 @@ layout_resize_adjust(struct window *w, struct layout_cell *lc,
/* Resizes a cell to a specified size */ /* Resizes a cell to a specified size */
void void
layout_resize_set(struct window *w, struct layout_cell *lc, layout_resize_set_size(struct window *w, struct layout_cell *lc,
enum layout_type type, u_int size) enum layout_type type, u_int size)
{ {
int change; int change;
@@ -667,40 +681,41 @@ layout_redistribute_cells(struct window *w, struct layout_cell *lcparent,
} }
} }
/* Helper function for layout_cell_get_neighbour. */ /* Find and return the nearest neighbour to a cell in a specific direction. */
static struct layout_cell * static struct layout_cell *
layout_cell_get_neighbour_direction(struct layout_cell *lc, int direction) layout_cell_get_neighbour_direction(struct layout_cell *lc, int direction)
{ {
struct layout_cell *lcother = lc; struct layout_cell *lcneighbour = lc;
while (1) { while (1) {
if (direction) if (direction)
lcother = TAILQ_NEXT(lcother, entry); lcneighbour = TAILQ_NEXT(lcneighbour, entry);
else else
lcother = TAILQ_PREV(lcother, layout_cells, entry); lcneighbour = TAILQ_PREV(lcneighbour, layout_cells,
entry);
if (lcother == NULL || layout_cell_is_tiled(lcother)) if (lcneighbour == NULL || layout_cell_is_tiled(lcneighbour) ||
return (lcother); layout_cell_has_tiled_child(lcneighbour))
return (lcneighbour);
} }
} }
/* /*
* Finds the nearest visible neighbour. A neighbour is a sibling cell drawn * Find and return the nearest neighbour. Prefers cells "after" the specified
* within the tiled layout. Prefers cells "before" the specified cell. * cell. This behavior defines how cell dimensions are redistributed when a cell
* This behavior defines how cell dimensions are redistributed when a cell is * is hidden/shown and floated/tiled.
* hidden/shown and floated/tiled.
*/ */
struct layout_cell * struct layout_cell *
layout_cell_get_neighbour(struct layout_cell *lc) layout_cell_get_neighbour(struct layout_cell *lc)
{ {
struct layout_cell *lcother, *lcparent = lc->parent; struct layout_cell *lcother, *lcparent = lc->parent;
int direction = 0; int direction = 1;
if (lcparent == NULL) if (lcparent == NULL)
return (NULL); return (NULL);
if (lc == TAILQ_FIRST(&lcparent->cells)) if (lc == TAILQ_LAST(&lcparent->cells, layout_cells))
direction = 1; direction = !direction;
lcother = layout_cell_get_neighbour_direction(lc, direction); lcother = layout_cell_get_neighbour_direction(lc, direction);
if (lcother == NULL) if (lcother == NULL)
@@ -709,8 +724,10 @@ layout_cell_get_neighbour(struct layout_cell *lc)
return lcother; return lcother;
} }
/*
/* Destroy a cell and redistribute the space if the cell was tiled. */ * Destroy a cell and redistribute the space if the cell was tiled. Assumes
* to be called on a leaf cell.
*/
void void
layout_destroy_cell(struct window *w, struct layout_cell *lc, layout_destroy_cell(struct window *w, struct layout_cell *lc,
struct layout_cell **lcroot) struct layout_cell **lcroot)
@@ -745,7 +762,7 @@ layout_destroy_cell(struct window *w, struct layout_cell *lc,
val = lc->sy + 1; val = lc->sy + 1;
layout_resize_adjust(w, lcother, lcparent->type, val); layout_resize_adjust(w, lcother, lcparent->type, val);
} else } else
layout_hide_cell(w, lcparent); layout_remove_tile(w, lcparent);
/* Remove this from the parent's list. */ /* Remove this from the parent's list. */
TAILQ_REMOVE(&lcparent->cells, lc, entry); TAILQ_REMOVE(&lcparent->cells, lc, entry);
@@ -761,6 +778,7 @@ out:
TAILQ_REMOVE(&lcparent->cells, lc, entry); TAILQ_REMOVE(&lcparent->cells, lc, entry);
lc->parent = lcparent->parent; lc->parent = lcparent->parent;
if (lc->parent == NULL) { if (lc->parent == NULL) {
if (layout_cell_is_tiled(lc)) if (layout_cell_is_tiled(lc))
layout_set_size(lc, w->sx, w->sy, 0, 0); layout_set_size(lc, w->sx, w->sy, 0, 0);
@@ -876,7 +894,7 @@ layout_resize(struct window *w, u_int sx, u_int sy)
* out proportionately - this should leave the layout fitting the new * out proportionately - this should leave the layout fitting the new
* window size. * window size.
*/ */
if (lc->type == LAYOUT_WINDOWPANE && !layout_cell_is_tiled(lc)) if (!layout_cell_is_tiled(lc))
return; return;
xchange = sx - lc->sx; xchange = sx - lc->sx;
xlimit = layout_resize_check(w, lc, LAYOUT_LEFTRIGHT); xlimit = layout_resize_check(w, lc, LAYOUT_LEFTRIGHT);
@@ -1251,7 +1269,8 @@ layout_resize_child_cells(struct window *w, struct layout_cell *lc)
count = 0; count = 0;
previous = 0; previous = 0;
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (!layout_cell_is_tiled(lcchild)) if (!layout_cell_is_tiled(lcchild) &&
!layout_cell_has_tiled_child(lcchild))
continue; continue;
count++; count++;
if (lc->type == LAYOUT_LEFTRIGHT) if (lc->type == LAYOUT_LEFTRIGHT)
@@ -1271,7 +1290,8 @@ layout_resize_child_cells(struct window *w, struct layout_cell *lc)
/* Resize children into the new size. */ /* Resize children into the new size. */
idx = 0; idx = 0;
TAILQ_FOREACH(lcchild, &lc->cells, entry) { TAILQ_FOREACH(lcchild, &lc->cells, entry) {
if (!layout_cell_is_tiled(lcchild)) if (!layout_cell_is_tiled(lcchild) &&
!layout_cell_has_tiled_child(lcchild))
continue; continue;
if (lc->type == LAYOUT_TOPBOTTOM) { if (lc->type == LAYOUT_TOPBOTTOM) {
lcchild->sx = lc->sx; lcchild->sx = lc->sx;
@@ -1333,7 +1353,7 @@ layout_split_check_space(struct window_pane *wp, struct layout_cell *lc,
/* Calculates the new cell sizes when splitting a pane. */ /* Calculates the new cell sizes when splitting a pane. */
void void
layout_split_sizes(struct layout_cell *lc, int size, int flags, layout_split_sizes(struct layout_cell *lc, int size, int before,
enum layout_type type, u_int *size1, u_int *size2, u_int *saved_size) enum layout_type type, u_int *size1, u_int *size2, u_int *saved_size)
{ {
u_int s1, s2, ss; u_int s1, s2, ss;
@@ -1345,7 +1365,7 @@ layout_split_sizes(struct layout_cell *lc, int size, int flags,
ss = sy; ss = sy;
if (size < 0) if (size < 0)
s2 = ((ss + 1) / 2) - 1; s2 = ((ss + 1) / 2) - 1;
else if (flags & SPAWN_BEFORE) else if (before)
s2 = ss - size - 1; s2 = ss - size - 1;
else else
s2 = size; s2 = size;
@@ -1373,6 +1393,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
u_int sx, sy, xoff, yoff, size1, size2; u_int sx, sy, xoff, yoff, size1, size2;
u_int new_size, saved_size, resize_first = 0; u_int new_size, saved_size, resize_first = 0;
int full_size = (flags & SPAWN_FULLSIZE); int full_size = (flags & SPAWN_FULLSIZE);
int before = (flags & SPAWN_BEFORE);
/* /*
* If full_size is specified, add a new cell at the top of the window * If full_size is specified, add a new cell at the top of the window
@@ -1397,7 +1418,7 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
* Calculate new cell sizes. size is the target size or -1 for middle * Calculate new cell sizes. size is the target size or -1 for middle
* split, size1 is the size of the top/left and size2 the bottom/right. * split, size1 is the size of the top/left and size2 the bottom/right.
*/ */
layout_split_sizes(lc, size, flags, type, &size1, &size2, &saved_size); layout_split_sizes(lc, size, before, type, &size1, &size2, &saved_size);
/* Which size are we using? */ /* Which size are we using? */
if (flags & SPAWN_BEFORE) if (flags & SPAWN_BEFORE)
@@ -1519,8 +1540,8 @@ layout_floating_pane(struct window *w, struct window_pane *wp, u_int sx,
if (lcparent == NULL) { if (lcparent == NULL) {
/* /*
* Adding a pane to a root that doesn't have a container. Must * Adding a pane to a root that isn't node. Must create and
* create and insert a new root. * insert a new root.
*/ */
lcparent = layout_create_cell(NULL); lcparent = layout_create_cell(NULL);
layout_make_node(lcparent, LAYOUT_TOPBOTTOM); layout_make_node(lcparent, LAYOUT_TOPBOTTOM);
@@ -1706,7 +1727,7 @@ layout_get_tiled_cell(struct cmdq_item *item, struct args *args,
} }
void void
layout_cell_floating_args(struct cmdq_item *item, struct args *args, layout_cell_floating_args_parse(struct cmdq_item *item, struct args *args,
struct window *w, u_int *sxp, u_int *syp, int *oxp, int *oyp, char **cause) struct window *w, u_int *sxp, u_int *syp, int *oxp, int *oyp, char **cause)
{ {
int sx, sy, ox, oy; int sx, sy, ox, oy;
@@ -1739,7 +1760,6 @@ layout_cell_floating_args(struct cmdq_item *item, struct args *args,
w->sy, item, cause); w->sy, item, cause);
if (*cause != NULL) if (*cause != NULL)
return; return;
>>>>>>> 5d81c9e4 (Updating tile-pane and float-pane to use new layout mechanics.)
} }
if (ox == INT_MAX) { if (ox == INT_MAX) {
@@ -1777,7 +1797,7 @@ layout_get_floating_cell(struct cmdq_item *item, struct args *args,
u_int sx, sy; u_int sx, sy;
int ox, oy; int ox, oy;
layout_cell_floating_args(item, args, w, &sx, &sy, &ox, &oy, cause); layout_cell_floating_args_parse(item, args, w, &sx, &sy, &ox, &oy, cause);
if (cause != NULL) { if (cause != NULL) {
return (NULL); return (NULL);
} }
@@ -1795,79 +1815,99 @@ layout_get_floating_cell(struct cmdq_item *item, struct args *args,
return (lcnew); return (lcnew);
} }
/*
* Removes a cell from the tiled layout by giving half the cells space to the
* nearest neighbour.
*/
int int
layout_remove_tile(struct window *w, struct layout_cell *lc) layout_remove_tile(struct window *w, struct layout_cell *lc)
{ {
struct layout_cell *lcother, *lcparent; struct layout_cell *lcneighbour, *lcparent;
enum layout_type type; enum layout_type type;
int change; int change;
if (lc->flags & LAYOUT_CELL_FLOATING) if (lc->flags & LAYOUT_CELL_FLOATING)
return (0); return (0);
lcother = layout_cell_get_neighbour(lc); lcneighbour = layout_cell_get_neighbour(lc);
if (lcother == NULL) { if (lcneighbour == NULL) {
layout_remove_tile(w, lc->parent); if (lc->parent != NULL)
} else if ((lcparent = lcother->parent) != NULL) { layout_remove_tile(w, lc->parent);
} else if ((lcparent = lcneighbour->parent) != NULL) {
type = lcparent->type; type = lcparent->type;
/*
* Adding the size of the layout cell plus its border to the
* neighbour.
*/
if (type == LAYOUT_TOPBOTTOM) if (type == LAYOUT_TOPBOTTOM)
change = lcother->sy + 1; change = lc->sy + 1;
else else
change = lcother->sx + 1; change = lc->sx + 1;
layout_resize_adjust(w, lcother, type, change); layout_resize_adjust(w, lcneighbour, type, change);
} }
/* Zeroing out the cell geometry until the cell is retiled. */
layout_set_size(lc, 0, 0, 0, 0); layout_set_size(lc, 0, 0, 0, 0);
return (1); return (1);
} }
/*
* Inserts a cell back into the tiled layout by taking half the space from its
* nearest neighbour.
*/
int int
layout_insert_tile(struct window *w, struct layout_cell *lc) layout_insert_tile(struct window *w, struct layout_cell *lc)
{ {
struct window_pane *wp; struct window_pane *wp;
struct layout_cell *lcother, *lcparent = lc->parent; struct layout_cell *lcneighbour, *lcparent = lc->parent;
enum layout_type type; enum layout_type type;
u_int size1, size2, saved_size; u_int size1, size2, saved_size;
int flags = 0;
if (lc == NULL) if (lc == NULL)
return (0); fatalx("layout cell cannot be null when tiling");
if (lcparent == NULL) { if (lcparent == NULL) {
/* Only pane in the layout. */
layout_set_size(lc, w->sx, w->sy, 0, 0); layout_set_size(lc, w->sx, w->sy, 0, 0);
return (1); return (1);
} }
type = lcparent->type; type = lcparent->type;
lcother = layout_cell_get_neighbour(lc); lcneighbour = layout_cell_get_neighbour(lc);
if (lcother == NULL) { if (lcneighbour == NULL) {
/* /*
* This is now the only revealed cell in the parent. Reveal the * This will become the only visible cell in the parent.
* parent, then set the child's 'type' dimension. * Tile the parent, then set the child's 'split' size.
*/ */
layout_insert_tile(w, lcparent); layout_insert_tile(w, lcparent);
if (type == LAYOUT_LEFTRIGHT) if (type == LAYOUT_LEFTRIGHT)
size1 = lcparent->sx; size1 = lcparent->sx;
else else
size1 = lcparent->sy; size1 = lcparent->sy;
layout_resize_set(w, lc, type, size1); layout_resize_set_size(w, lc, type, size1);
} else { } else {
if (lcother->wp == NULL) /* neighbour is a container */
wp = TAILQ_FIRST(&lcother->cells)->wp;
else
wp = lcother->wp;
/* /*
* Failure point requires clearing concealed flag in many spots * In order to determine if there is enough space to retile the
* pane, information is needed from window and window pane
* options. First get a neightbour window pane...
*/ */
if (!layout_split_check_space(wp, lcother, type)) if (~lcneighbour->type & LAYOUT_WINDOWPANE)
wp = TAILQ_FIRST(&lcneighbour->cells)->wp;
else
wp = lcneighbour->wp;
/*
* ...and then check if there is enough room to tile.
*/
if (!layout_split_check_space(wp, lcneighbour, type))
return (0); return (0);
layout_split_sizes(lcother, -1, flags, type, &size1, &size2,
layout_split_sizes(lcneighbour, -1, 0, type, &size1, &size2,
&saved_size); &saved_size);
layout_resize_set(w, lc, type, size1); layout_resize_set_size(w, lc, type, size1);
layout_resize_set(w, lcother, type, size2); layout_resize_set_size(w, lcneighbour, type, size2);
} }
/* Setting the opposite of 'type' dimension. */ /* Setting opposite of the 'split' size to that of the parent. */
if (lcparent != NULL) { if (lcparent != NULL) {
if (lcparent->type == LAYOUT_LEFTRIGHT) { if (lcparent->type == LAYOUT_LEFTRIGHT) {
size1 = lcparent->sy; size1 = lcparent->sy;
@@ -1876,7 +1916,7 @@ layout_insert_tile(struct window *w, struct layout_cell *lc)
size1 = lcparent->sx; size1 = lcparent->sx;
type = LAYOUT_LEFTRIGHT; type = LAYOUT_LEFTRIGHT;
} }
layout_resize_set(w, lc, type, size1); layout_resize_set_size(w, lc, type, size1);
} }
return (1); return (1);
} }

28
tmux.1
View File

@@ -3120,8 +3120,8 @@ command works only if at least one client is attached.
.Tg floatp .Tg floatp
.It Xo Ic float\-pane .It Xo Ic float\-pane
.Op Fl d .Op Fl d
.Op Fl x Ar height .Op Fl x Ar width
.Op Fl y Ar width .Op Fl y Ar height
.Op Fl X Ar x\-position .Op Fl X Ar x\-position
.Op Fl y Ar y\-position .Op Fl y Ar y\-position
.Op Fl t Ar target\-pane .Op Fl t Ar target\-pane
@@ -3129,7 +3129,7 @@ command works only if at least one client is attached.
.D1 Pq alias: Ic floatp .D1 Pq alias: Ic floatp
Lift Lift
.Ar target\-pane .Ar target\-pane
out of the tiled layout and make it a floating pane. out of the tiled layout and make it floating.
The The
.Fl x .Fl x
and and
@@ -3144,13 +3144,14 @@ and
options set the position of the upper-left corner of the pane. options set the position of the upper-left corner of the pane.
If omitted, new floating panes are cascaded from the top-left of the window. If omitted, new floating panes are cascaded from the top-left of the window.
.Pp .Pp
If the pane has previously been floating, the geometry is restored for If the pane had previously been floating, the position and sizes are restored
dimensions not specified by the provided arguments: from the saved values not specified by the
.Fl x , .Fl x ,
.Fl y , .Fl y ,
.Fl X , .Fl X ,
or and
.Fl Y . .Fl Y
options.
.Pp .Pp
If If
.Fl d .Fl d
@@ -4077,16 +4078,15 @@ Return a floating
.Ar target\-pane .Ar target\-pane
back to the tiled layout. back to the tiled layout.
The location in the layout is preserved. The location in the layout is preserved.
The pane's takes half the relevant dimension from the nearest tiled pane in the Half the space from the nearest tiled pane in the layout is given to
layout. .Ar target\-pane .
The current floating position and size are saved so they can be restored by The floating position and sizes are saved so they can be restored by future
a subsequent calls to
.Ic float\-pane .Ic float\-pane .
comman.
The pane must be floating, not hidden, and the window must not be zoomed.
If If
.Fl d .Fl d
is given, the active pane is not changed. is given, the active pane is not changed.
The pane must be floating, not hidden, and the window must not be zoomed.
.Tg showp .Tg showp
.It Xo Ic show\-pane .It Xo Ic show\-pane
.Op Fl t Ar target\-pane .Op Fl t Ar target\-pane

4
tmux.h
View File

@@ -3559,7 +3559,7 @@ void layout_fix_offsets(struct window *);
void layout_fix_panes(struct window *, struct window_pane *); void layout_fix_panes(struct window *, struct window_pane *);
void layout_resize_adjust(struct window *, struct layout_cell *, void layout_resize_adjust(struct window *, struct layout_cell *,
enum layout_type, int); enum layout_type, int);
void layout_resize_set(struct window *, struct layout_cell *, void layout_resize_set_size(struct window *, struct layout_cell *,
enum layout_type, u_int); enum layout_type, u_int);
struct layout_cell *layout_cell_get_neighbour(struct layout_cell *); struct layout_cell *layout_cell_get_neighbour(struct layout_cell *);
void layout_init(struct window *, struct window_pane *); void layout_init(struct window *, struct window_pane *);
@@ -3586,7 +3586,7 @@ struct layout_cell *layout_floating_pane(struct window *, struct window_pane *,
void layout_close_pane(struct window_pane *); void layout_close_pane(struct window_pane *);
int layout_spread_cell(struct window *, struct layout_cell *); int layout_spread_cell(struct window *, struct layout_cell *);
void layout_spread_out(struct window_pane *); void layout_spread_out(struct window_pane *);
void layout_cell_floating_args(struct cmdq_item *, struct args *, void layout_cell_floating_args_parse(struct cmdq_item *, struct args *,
struct window *, u_int *, u_int *, int *, int *, char **); struct window *, u_int *, u_int *, int *, int *, char **);
struct layout_cell *layout_get_floating_cell(struct cmdq_item *, struct args *, struct layout_cell *layout_get_floating_cell(struct cmdq_item *, struct args *,
struct window *, struct window_pane *, char **); struct window *, struct window_pane *, char **);

View File

@@ -2214,7 +2214,7 @@ window_pane_is_hidden(struct window_pane *wp)
{ {
struct layout_cell *lc = wp->layout_cell; struct layout_cell *lc = wp->layout_cell;
if (lc == NULL || (lc->flags & LAYOUT_CELL_HIDDEN) == 0) if ((lc->flags & LAYOUT_CELL_HIDDEN) == 0)
return (0); return (0);
return (1); return (1);
} }