aboutsummaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authornicm <nicm>2020-06-05 11:20:51 +0000
committernicm <nicm>2020-06-05 11:20:51 +0000
commitd919fa1ed0ea3b167ffc811abba26a2dbcd20631 (patch)
tree58ff37d45126b5f3f99e2535820e58257f6a6528 /window.c
parent03b2998abe7712324a1a2ca254167dcc1ce28e4d (diff)
downloadrtmux-d919fa1ed0ea3b167ffc811abba26a2dbcd20631.tar.gz
rtmux-d919fa1ed0ea3b167ffc811abba26a2dbcd20631.tar.bz2
rtmux-d919fa1ed0ea3b167ffc811abba26a2dbcd20631.zip
Change how panes are resized so that the code is clearer and if the pane
is resized multiple times during one event loop, it is forced to resize at the end. Also don't zoom/unzoom in switch-client if the pane hasn't changed. GitHub issue 2260.
Diffstat (limited to 'window.c')
-rw-r--r--window.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/window.c b/window.c
index 020ae4bf..523e9913 100644
--- a/window.c
+++ b/window.c
@@ -436,14 +436,21 @@ window_resize(struct window *w, u_int sx, u_int sy, int xpixel, int ypixel)
}
void
-window_pane_send_resize(struct window_pane *wp, int yadjust)
+window_pane_send_resize(struct window_pane *wp, int force)
{
struct window *w = wp->window;
struct winsize ws;
- u_int sy = wp->sy + yadjust;
+ u_int sy;
if (wp->fd == -1)
return;
+
+ if (!force)
+ sy = wp->sy;
+ else if (wp->sy <= 1)
+ sy = wp->sy + 1;
+ else
+ sy = wp->sy - 1;
log_debug("%s: %%%u resize to %u,%u", __func__, wp->id, wp->sx, sy);
memset(&ws, 0, sizeof ws);
@@ -877,8 +884,8 @@ window_pane_create(struct window *w, u_int sx, u_int sy, u_int hlimit)
wp->xoff = 0;
wp->yoff = 0;
- wp->sx = wp->osx = sx;
- wp->sy = wp->osx = sy;
+ wp->sx = sx;
+ wp->sy = sy;
wp->pipe_fd = -1;
wp->pipe_event = NULL;
@@ -918,6 +925,8 @@ window_pane_destroy(struct window_pane *wp)
if (event_initialized(&wp->resize_timer))
event_del(&wp->resize_timer);
+ if (event_initialized(&wp->force_timer))
+ event_del(&wp->force_timer);
RB_REMOVE(window_pane_tree, &all_window_panes, wp);
@@ -998,7 +1007,14 @@ window_pane_resize(struct window_pane *wp, u_int sx, u_int sy)
wme = TAILQ_FIRST(&wp->modes);
if (wme != NULL && wme->mode->resize != NULL)
wme->mode->resize(wme, sx, sy);
- wp->flags |= (PANE_RESIZE|PANE_RESIZED);
+
+ /*
+ * If the pane has already been resized, set the force flag and make
+ * the application resize twice to force it to redraw.
+ */
+ if (wp->flags & PANE_RESIZE)
+ wp->flags |= PANE_RESIZEFORCE;
+ wp->flags |= PANE_RESIZE;
}
void