Bring over some of layout and positioning code for floating panes, by

Michael Grant.
This commit is contained in:
nicm
2026-05-17 16:01:42 +00:00
parent f12d7b4e67
commit a8520ba59e
12 changed files with 282 additions and 133 deletions

22
tmux.h
View File

@@ -1302,9 +1302,11 @@ struct window_pane {
TAILQ_ENTRY(window_pane) entry; /* link in list of all panes */
TAILQ_ENTRY(window_pane) sentry; /* link in list of last visited */
TAILQ_ENTRY(window_pane) zentry; /* z-index link in list of all panes */
RB_ENTRY(window_pane) tree_entry;
};
TAILQ_HEAD(window_panes, window_pane);
TAILQ_HEAD(window_panes_zindex, window_pane);
RB_HEAD(window_pane_tree, window_pane);
/* Window structure. */
@@ -1324,6 +1326,7 @@ struct window {
struct window_pane *active;
struct window_panes last_panes;
struct window_panes z_index;
struct window_panes panes;
int lastlayout;
@@ -1417,6 +1420,7 @@ TAILQ_HEAD(winlink_stack, winlink);
enum layout_type {
LAYOUT_LEFTRIGHT,
LAYOUT_TOPBOTTOM,
LAYOUT_FLOATING,
LAYOUT_WINDOWPANE
};
@@ -1432,8 +1436,8 @@ struct layout_cell {
u_int sx;
u_int sy;
u_int xoff;
u_int yoff;
int xoff;
int yoff;
struct window_pane *wp;
struct layout_cells cells;
@@ -1710,10 +1714,10 @@ struct tty_ctx {
u_int orlower;
/* Target region (usually pane) offset and size. */
u_int xoff;
u_int yoff;
u_int rxoff;
u_int ryoff;
int xoff;
int yoff;
int rxoff;
int ryoff;
u_int sx;
u_int sy;
@@ -2284,6 +2288,7 @@ struct spawn_context {
#define SPAWN_FULLSIZE 0x20
#define SPAWN_EMPTY 0x40
#define SPAWN_ZOOM 0x80
#define SPAWN_FLOATING 0x100
};
/* Paste buffer. */
@@ -3362,7 +3367,7 @@ struct window_pane *window_pane_next_by_number(struct window *,
struct window_pane *window_pane_previous_by_number(struct window *,
struct window_pane *, u_int);
int window_pane_index(struct window_pane *, u_int *);
u_int window_count_panes(struct window *);
u_int window_count_panes(struct window *, int);
void window_destroy_panes(struct window *);
struct window_pane *window_pane_find_by_id_str(const char *);
struct window_pane *window_pane_find_by_id(u_int);
@@ -3430,8 +3435,7 @@ void layout_destroy_cell(struct window *, struct layout_cell *,
void layout_resize_layout(struct window *, struct layout_cell *,
enum layout_type, int, int);
struct layout_cell *layout_search_by_border(struct layout_cell *, u_int, u_int);
void layout_set_size(struct layout_cell *, u_int, u_int, u_int,
u_int);
void layout_set_size(struct layout_cell *, u_int, u_int, int, int);
void layout_make_leaf(struct layout_cell *, struct window_pane *);
void layout_make_node(struct layout_cell *, enum layout_type);
void layout_fix_offsets(struct window *);