mirror of
https://github.com/tmux/tmux.git
synced 2026-01-11 16:30:22 +00:00
1. Rework floating panes to have a stub layout_cell, 2. Add new <..> format to list-windows & select-layout for floating anes, 3. Fix zooming to work with floating panes, 4. Fix several display issues.
This commit is contained in:
@@ -82,14 +82,14 @@ cmd_resize_pane_exec(struct cmd *self, struct cmdq_item *item)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (c == NULL || c->session != s)
|
||||
return (CMD_RETURN_NORMAL);
|
||||
if (c->tty.mouse_wp->layout_cell != NULL) {
|
||||
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_tiled;
|
||||
cmd_resize_pane_mouse_update_tiled(c, &event->m);
|
||||
} else {
|
||||
if (c->tty.mouse_wp->flags & PANE_FLOATING) {
|
||||
window_redraw_active_switch(w, c->tty.mouse_wp);
|
||||
window_set_active_pane(w, c->tty.mouse_wp, 1);
|
||||
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_floating;
|
||||
cmd_resize_pane_mouse_update_floating(c, &event->m);
|
||||
} else {
|
||||
c->tty.mouse_drag_update = cmd_resize_pane_mouse_update_tiled;
|
||||
cmd_resize_pane_mouse_update_tiled(c, &event->m);
|
||||
}
|
||||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
@@ -163,7 +163,9 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
struct winlink *wl;
|
||||
struct window *w;
|
||||
struct window_pane *wp;
|
||||
u_int y, ly, x, lx, new_sx, new_sy, resizes = 0;
|
||||
struct layout_cell *lc;
|
||||
u_int y, ly, x, lx, new_sx, new_sy;
|
||||
int new_xoff, new_yoff, resizes = 0;
|
||||
|
||||
wl = cmd_mouse_window(m, NULL);
|
||||
if (wl == NULL) {
|
||||
@@ -184,89 +186,93 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
ly = m->statusat - 1;
|
||||
|
||||
wp = c->tty.mouse_wp;
|
||||
lc = wp->layout_cell;
|
||||
|
||||
log_debug("%s: %%%u resize_pane xoff=%u sx=%u xy=%ux%u lxy=%ux%u",
|
||||
__func__, wp->id, wp->xoff, wp->sx, x, y, lx, ly);
|
||||
if ((((int)lx == wp->xoff - 1) || ((int)lx == wp->xoff)) &&
|
||||
((int)ly == wp->yoff - 1)) {
|
||||
/* Top left border */
|
||||
new_sx = wp->sx + (lx - x);
|
||||
/* Top left corner */
|
||||
new_sx = lc->sx + (lx - x);
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
new_sx = PANE_MINIMUM;
|
||||
new_sy = wp->sy + (ly - y);
|
||||
new_sy = lc->sy + (ly - y);
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
new_sy = PANE_MINIMUM;
|
||||
window_pane_move(wp, x + 1, y + 1);
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
new_xoff = x + 1; /* Because mouse is on border at xoff - 1 */
|
||||
new_yoff = y + 1;
|
||||
layout_set_size(lc, new_sx, new_sy, new_xoff, new_yoff);
|
||||
resizes++;
|
||||
} else if ((((int)lx == wp->xoff + (int)wp->sx + 1) ||
|
||||
((int)lx == wp->xoff + (int)wp->sx)) &&
|
||||
((int)ly == wp->yoff - 1)) {
|
||||
/* Top right border */
|
||||
new_sx = x - wp->xoff - 1;
|
||||
/* Top right corner */
|
||||
new_sx = x - lc->xoff;
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
new_sx = PANE_MINIMUM;
|
||||
new_sy = wp->sy + (ly - y);
|
||||
new_sy = lc->sy + (ly - y);
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
new_sy = PANE_MINIMUM;
|
||||
window_pane_move(wp, wp->xoff, y + 1);
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
new_yoff = y + 1;
|
||||
layout_set_size(lc, new_sx, new_sy, lc->xoff, new_yoff);
|
||||
resizes++;
|
||||
} else if ((((int)lx == wp->xoff - 1) || ((int)lx == wp->xoff)) &&
|
||||
((int)ly == wp->yoff + (int)wp->sy)) {
|
||||
/* Bottom left border */
|
||||
new_sx = wp->sx + (lx - x);
|
||||
/* Bottom left corner */
|
||||
new_sx = lc->sx + (lx - x);
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
new_sx = PANE_MINIMUM;
|
||||
new_sy = y - wp->yoff;
|
||||
new_sy = y - lc->yoff;
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_move(wp, x + 1, wp->yoff);
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
new_xoff = x + 1;
|
||||
layout_set_size(lc, new_sx, new_sy, new_xoff, lc->yoff);
|
||||
resizes++;
|
||||
} else if ((((int)lx == wp->xoff + (int)wp->sx + 1) ||
|
||||
((int)lx == wp->xoff + (int)wp->sx)) &&
|
||||
((int)ly == wp->yoff + (int)wp->sy)) {
|
||||
/* Bottom right corner */
|
||||
new_sx = x - wp->xoff - 1;
|
||||
new_sx = x - lc->xoff;
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
new_sx = PANE_MINIMUM;
|
||||
new_sy = y - wp->yoff;
|
||||
new_sy = y - lc->yoff;
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
new_sy = PANE_MINIMUM;
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
layout_set_size(lc, new_sx, new_sy, lc->xoff, lc->yoff);
|
||||
resizes++;
|
||||
} else if ((int)lx == wp->xoff + (int)wp->sx + 1) {
|
||||
/* Right border */
|
||||
new_sx = x - wp->xoff - 1;
|
||||
new_sx = x - lc->xoff;
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_resize(wp, new_sx, wp->sy);
|
||||
layout_set_size(lc, new_sx, lc->sy, lc->xoff, lc->yoff);
|
||||
resizes++;
|
||||
} else if ((int)lx == wp->xoff - 1) {
|
||||
/* Left border */
|
||||
new_sx = wp->sx + (lx - x);
|
||||
new_sx = lc->sx + (lx - x);
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_move(wp, x + 1, wp->yoff);
|
||||
window_pane_resize(wp, new_sx, wp->sy);
|
||||
new_xoff = x + 1;
|
||||
layout_set_size(lc, new_sx, lc->sy, new_xoff, lc->yoff);
|
||||
resizes++;
|
||||
} else if ((int)ly == wp->yoff + (int)wp->sy) {
|
||||
/* Bottom border */
|
||||
new_sy = y - wp->yoff;
|
||||
new_sy = y - lc->yoff;
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_resize(wp, wp->sx, new_sy);
|
||||
layout_set_size(lc, lc->sx, new_sy, lc->xoff, lc->yoff);
|
||||
resizes++;
|
||||
} else if ((int)ly == wp->yoff - 1) {
|
||||
/* Top border */
|
||||
window_pane_move(wp, wp->xoff + (x - lx), y + 1);
|
||||
/*
|
||||
/* Top border (move instead of resize) */
|
||||
new_xoff = lc->xoff + (x - lx);
|
||||
new_yoff = y + 1;
|
||||
layout_set_size(lc, lc->sx, lc->sy, new_xoff, new_yoff);
|
||||
/* To resize instead of move:
|
||||
new_sy = wp->sy + (ly - y);
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_move(wp, wp->xoff, y + 1);
|
||||
window_pane_resize(wp, wp->sx, new_sy);
|
||||
new_yoff = y + 1;
|
||||
layout_set_size(lc, lc->sx, new_sy, lc->xoff, new_yoff);
|
||||
*/
|
||||
resizes++;
|
||||
} else {
|
||||
@@ -274,6 +280,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
__func__, wp->id, wp->xoff, wp->sx, x, y, lx, ly);
|
||||
}
|
||||
if (resizes != 0) {
|
||||
layout_fix_panes(w, NULL);
|
||||
server_redraw_window(w);
|
||||
server_redraw_window_borders(w);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user