mirror of
https://github.com/tmux/tmux.git
synced 2026-05-30 08:45:47 +00:00
Merge branch 'floating_panes' into floating_panes_staging
This commit is contained in:
3
tmux.h
3
tmux.h
@@ -1378,9 +1378,6 @@ struct window {
|
||||
u_int xpixel;
|
||||
u_int ypixel;
|
||||
|
||||
u_int last_new_pane_x;
|
||||
u_int last_new_pane_y;
|
||||
|
||||
u_int new_sx;
|
||||
u_int new_sy;
|
||||
u_int new_xpixel;
|
||||
|
||||
65
window.c
65
window.c
@@ -2123,71 +2123,6 @@ window_pane_tiled_geometry(struct window *w, struct window_pane *wp,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
window_pane_float_geometry(struct window *w, struct window_pane *wp,
|
||||
u_int *out_x, u_int *out_y, u_int *out_sx, u_int *out_sy,
|
||||
struct cmdq_item *item, struct args *args, char **cause)
|
||||
{
|
||||
u_int x, y, sx, sy;
|
||||
const u_int cx = 4, cy = 2;
|
||||
|
||||
/* Default size. */
|
||||
sx = w->sx / 2;
|
||||
sy = w->sy / 2;
|
||||
|
||||
if (args_has(args, 'x')) {
|
||||
sx = args_percentage_and_expand(args, 'x', 0, USHRT_MAX, w->sx,
|
||||
item, cause);
|
||||
if (*cause != NULL)
|
||||
return (-1);
|
||||
}
|
||||
if (args_has(args, 'y')) {
|
||||
sy = args_percentage_and_expand(args, 'y', 0, USHRT_MAX, w->sy,
|
||||
item, cause);
|
||||
if (*cause != NULL)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Position defaults to cascading when not defined. */
|
||||
if (args_has(args, 'X')) {
|
||||
x = args_percentage_and_expand(args, 'X', 0, USHRT_MAX, w->sx,
|
||||
item, cause);
|
||||
if (*cause != NULL)
|
||||
return (-1);
|
||||
} else {
|
||||
if (w->last_new_pane_x == 0)
|
||||
x = cx;
|
||||
else {
|
||||
x = w->last_new_pane_x + cx;
|
||||
if (w->last_new_pane_x > w->sx)
|
||||
x = cx;
|
||||
}
|
||||
w->last_new_pane_x = x;
|
||||
}
|
||||
if (args_has(args, 'Y')) {
|
||||
y = args_percentage_and_expand(args, 'Y', 0, USHRT_MAX, w->sy,
|
||||
item, cause);
|
||||
if (*cause != NULL)
|
||||
return (-1);
|
||||
} else {
|
||||
if (w->last_new_pane_y == 0)
|
||||
y = cy;
|
||||
else {
|
||||
y = w->last_new_pane_y + cy;
|
||||
if (w->last_new_pane_y > w->sy)
|
||||
y = cy;
|
||||
}
|
||||
w->last_new_pane_y = y;
|
||||
}
|
||||
|
||||
out:
|
||||
*out_x = x;
|
||||
*out_y = y;
|
||||
*out_sx = sx;
|
||||
*out_sy = sy;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Work out geometry for floating panes. */
|
||||
int
|
||||
window_pane_floating_geometry(struct window *w, __unused struct window_pane *wp,
|
||||
|
||||
Reference in New Issue
Block a user