mirror of
https://github.com/tmux/tmux.git
synced 2026-06-20 17:25:57 +00:00
Layout cells for floating panes are now inserted after the cell of a
provided window pane.
This commit is contained in:
21
layout.c
21
layout.c
@@ -1328,12 +1328,16 @@ layout_split_pane(struct window_pane *wp, enum layout_type type, int size,
|
||||
* layout_assign_pane before much else happens!
|
||||
*/
|
||||
struct layout_cell *
|
||||
layout_floating_pane(struct window *w, struct layout_cell *lc, u_int sx,
|
||||
layout_floating_pane(struct window *w, struct window_pane *wp, u_int sx,
|
||||
u_int sy, int ox, int oy)
|
||||
{
|
||||
struct layout_cell *lc = w->layout_root, *lcnew, *lcparent;
|
||||
struct layout_cell *lc = wp->layout_cell, *lcnew, *lcparent;
|
||||
|
||||
if (lc->type == LAYOUT_WINDOWPANE) {
|
||||
if (lc == NULL)
|
||||
lc = w->layout_root;
|
||||
lcparent = lc->parent;
|
||||
|
||||
if (lcparent == NULL) {
|
||||
/*
|
||||
* Adding a pane to a root that doesn't have a container. Must
|
||||
* create and insert a new root.
|
||||
@@ -1346,11 +1350,10 @@ layout_floating_pane(struct window *w, struct layout_cell *lc, u_int sx,
|
||||
/* Insert the old cell. */
|
||||
lc->parent = lcparent;
|
||||
TAILQ_INSERT_HEAD(&lcparent->cells, lc, entry);
|
||||
} else
|
||||
lcparent = w->layout_root;
|
||||
}
|
||||
|
||||
lcnew = layout_create_cell(lcparent);
|
||||
TAILQ_INSERT_TAIL(&lcparent->cells, lcnew, entry);
|
||||
TAILQ_INSERT_AFTER(&lcparent->cells, lc, lcnew, entry);
|
||||
lcnew->flags |= LAYOUT_CELL_FLOATING;
|
||||
layout_set_size(lcnew, sx, sy, ox, oy);
|
||||
|
||||
@@ -1525,10 +1528,10 @@ layout_get_tiled_cell(struct cmdq_item *item, struct args *args,
|
||||
/* Get a new floating cell. */
|
||||
struct layout_cell *
|
||||
layout_get_floating_cell(struct cmdq_item *item, struct args *args,
|
||||
struct window *w, __unused struct window_pane *wp, char **cause)
|
||||
struct window *w, struct window_pane *wp, char **cause)
|
||||
{
|
||||
struct layout_cell *lcnew;
|
||||
int sx = w->sx / 2, sy = w->sy / 4;
|
||||
u_int sx = w->sx / 2, sy = w->sy / 4;
|
||||
int ox = INT_MAX, oy = INT_MAX;
|
||||
|
||||
if (args_has(args, 'x')) {
|
||||
@@ -1577,6 +1580,6 @@ layout_get_floating_cell(struct cmdq_item *item, struct args *args,
|
||||
w->last_new_pane_y = oy;
|
||||
}
|
||||
|
||||
lcnew = layout_floating_pane(w, sx, sy, ox, oy);
|
||||
lcnew = layout_floating_pane(w, wp, sx, sy, ox, oy);
|
||||
return (lcnew);
|
||||
}
|
||||
|
||||
2
tmux.h
2
tmux.h
@@ -3552,7 +3552,7 @@ void layout_assign_pane(struct layout_cell *, struct window_pane *,
|
||||
int);
|
||||
struct layout_cell *layout_split_pane(struct window_pane *, enum layout_type,
|
||||
int, int);
|
||||
struct layout_cell *layout_floating_pane(struct window *, struct layout_cell *,
|
||||
struct layout_cell *layout_floating_pane(struct window *, struct window_pane *,
|
||||
u_int, u_int, int, int);
|
||||
void layout_close_pane(struct window_pane *);
|
||||
int layout_spread_cell(struct window *, struct layout_cell *);
|
||||
|
||||
Reference in New Issue
Block a user