mirror of
https://github.com/tmux/tmux.git
synced 2026-01-11 16:30:22 +00:00
Fix floating pane redraw bugs. Allow floating panes to be partly out of the window. This required changing xoff and yoff from u_int to int and it required a fair bit of casting for example when xoff is added to sx or comparing px to xoff. It makes sense for px and sx to be u_int since they refers to things which should never be negative.
This commit is contained in:
@@ -161,7 +161,7 @@ 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;
|
||||
u_int y, ly, x, lx, new_sx, new_sy, resizes = 0;
|
||||
|
||||
wl = cmd_mouse_window(m, NULL);
|
||||
if (wl == NULL) {
|
||||
@@ -176,7 +176,7 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
else if (m->statusat > 0 && y >= (u_int)m->statusat)
|
||||
y = m->statusat - 1;
|
||||
ly = m->ly + m->oy; lx = m->lx + m->ox;
|
||||
if (m->statusat == 0 && ly >= m->statuslines)
|
||||
if (m->statusat == 0 && ly >= (u_int)m->statuslines)
|
||||
ly -= m->statuslines;
|
||||
else if (m->statusat > 0 && ly >= (u_int)m->statusat)
|
||||
ly = m->statusat - 1;
|
||||
@@ -185,8 +185,8 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
|
||||
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 (((m->lx == wp->xoff - 1) || (m->lx == wp->xoff)) &&
|
||||
(m->ly == wp->yoff - 1)) {
|
||||
if ((((int)lx == wp->xoff - 1) || ((int)lx == wp->xoff)) &&
|
||||
((int)ly == wp->yoff - 1)) {
|
||||
/* Top left border */
|
||||
new_sx = wp->sx + (lx - x);
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
@@ -196,10 +196,10 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
new_sy = PANE_MINIMUM;
|
||||
window_pane_move(wp, x + 1, y + 1);
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
server_redraw_window(w);
|
||||
} else if (((m->lx == wp->xoff + wp->sx + 1) ||
|
||||
(m->lx == wp->xoff + wp->sx)) &&
|
||||
(m->ly == wp->yoff - 1)) {
|
||||
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;
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
@@ -209,9 +209,9 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
new_sy = PANE_MINIMUM;
|
||||
window_pane_move(wp, wp->xoff, y + 1);
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
server_redraw_window(w);
|
||||
} else if (((m->lx == wp->xoff - 1) || (m->lx == wp->xoff)) &&
|
||||
(m->ly == wp->yoff + wp->sy)) {
|
||||
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);
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
@@ -221,10 +221,10 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
return;
|
||||
window_pane_move(wp, x + 1, wp->yoff);
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
server_redraw_window(w);
|
||||
} else if (((m->lx == wp->xoff + wp->sx + 1) ||
|
||||
(m->lx == wp->xoff + wp->sx)) &&
|
||||
(m->ly == wp->yoff + wp->sy)) {
|
||||
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;
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
@@ -233,30 +233,30 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
new_sy = PANE_MINIMUM;
|
||||
window_pane_resize(wp, new_sx, new_sy);
|
||||
server_redraw_window(w);
|
||||
} else if (m->lx == wp->xoff + wp->sx + 1) {
|
||||
resizes++;
|
||||
} else if ((int)lx == wp->xoff + (int)wp->sx + 1) {
|
||||
/* Right border */
|
||||
new_sx = x - wp->xoff - 1;
|
||||
if (new_sx < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_resize(wp, new_sx, wp->sy);
|
||||
server_redraw_window(w);
|
||||
} else if (m->lx == wp->xoff - 1) {
|
||||
resizes++;
|
||||
} else if ((int)lx == wp->xoff - 1) {
|
||||
/* Left border */
|
||||
new_sx = wp->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);
|
||||
server_redraw_window(w);
|
||||
} else if (m->ly == wp->yoff + wp->sy) {
|
||||
resizes++;
|
||||
} else if ((int)ly == wp->yoff + (int)wp->sy) {
|
||||
/* Bottom border */
|
||||
new_sy = y - wp->yoff;
|
||||
if (new_sy < PANE_MINIMUM)
|
||||
return;
|
||||
window_pane_resize(wp, wp->sx, new_sy);
|
||||
server_redraw_window(w);
|
||||
} else if (m->ly == wp->yoff - 1) {
|
||||
resizes++;
|
||||
} else if ((int)ly == wp->yoff - 1) {
|
||||
/* Top border */
|
||||
window_pane_move(wp, wp->xoff + (x - lx), y + 1);
|
||||
/*
|
||||
@@ -266,11 +266,15 @@ cmd_resize_pane_mouse_update_floating(struct client *c, struct mouse_event *m)
|
||||
window_pane_move(wp, wp->xoff, y + 1);
|
||||
window_pane_resize(wp, wp->sx, new_sy);
|
||||
*/
|
||||
server_redraw_window(w);
|
||||
resizes++;
|
||||
} else {
|
||||
log_debug("%s: %%%u resize_pane xoff=%u sx=%u xy=%ux%u lxy=%ux%u <else>",
|
||||
__func__, wp->id, wp->xoff, wp->sx, x, y, lx, ly);
|
||||
}
|
||||
if (resizes != 0) {
|
||||
server_redraw_window(w);
|
||||
server_redraw_window_borders(w);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user