diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-04-19 00:01:31 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-04-19 00:01:31 +0100 |
commit | 8c9bbc37495b31f3decaeaa38d21bd42121bcd70 (patch) | |
tree | 539f9c3c2d773536c29c69a4baa5b57e0c731019 /server-client.c | |
parent | 7da5418758eab32bd247826e512bba3e413936d6 (diff) | |
parent | 62ff5e4b010a9db695c79593d20ac92b0aed9558 (diff) | |
download | rtmux-8c9bbc37495b31f3decaeaa38d21bd42121bcd70.tar.gz rtmux-8c9bbc37495b31f3decaeaa38d21bd42121bcd70.tar.bz2 rtmux-8c9bbc37495b31f3decaeaa38d21bd42121bcd70.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/server-client.c b/server-client.c index 91db6e0d..03cef59e 100644 --- a/server-client.c +++ b/server-client.c @@ -1368,6 +1368,7 @@ server_client_loop(void) if (resize) server_client_check_resize(wp); } + wp->flags &= ~PANE_REDRAW; } check_window_name(w); } @@ -1677,8 +1678,11 @@ server_client_check_redraw(struct client *c) { struct session *s = c->session; struct tty *tty = &c->tty; + struct window *w = c->session->curw->window; struct window_pane *wp; int needed, flags, mode = tty->mode, new_flags = 0; + int redraw; + u_int bit = 0; struct timeval tv = { .tv_usec = 1000 }; static struct event ev; size_t left; @@ -1703,7 +1707,7 @@ server_client_check_redraw(struct client *c) if (c->flags & CLIENT_ALLREDRAWFLAGS) needed = 1; else { - TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) { + TAILQ_FOREACH(wp, &w->panes, entry) { if (wp->flags & PANE_REDRAW) { needed = 1; break; @@ -1720,25 +1724,46 @@ server_client_check_redraw(struct client *c) log_debug("redraw timer started"); evtimer_add(&ev, &tv); } + if (new_flags & CLIENT_REDRAWPANES) { + c->redraw_panes = 0; + TAILQ_FOREACH(wp, &w->panes, entry) { + if (wp->flags & PANE_REDRAW) + c->redraw_panes |= (1 << bit); + if (++bit == 64) { + /* + * If more that 64 panes, give up and + * just redraw the window. + */ + new_flags &= CLIENT_REDRAWPANES; + new_flags |= CLIENT_REDRAWWINDOW; + break; + } + } + } c->flags |= new_flags; return; } else if (needed) log_debug("%s: redraw needed", c->name); flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR); - tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE)) | TTY_NOCURSOR; + tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE))|TTY_NOCURSOR; if (~c->flags & CLIENT_REDRAWWINDOW) { /* * If not redrawing the entire window, check whether each pane * needs to be redrawn. */ - TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) { - if (wp->flags & PANE_REDRAW) { - log_debug("%s: redrawing pane %%%u", __func__, wp->id); - tty_update_mode(tty, mode, NULL); - screen_redraw_pane(c, wp); - } + TAILQ_FOREACH(wp, &w->panes, entry) { + redraw = 0; + if (wp->flags & PANE_REDRAW) + redraw = 1; + else if (c->flags & CLIENT_REDRAWPANES) + redraw = !!(c->redraw_panes & (1 << bit)); + if (!redraw) + continue; + log_debug("%s: redrawing pane %%%u", __func__, wp->id); + tty_update_mode(tty, mode, NULL); + screen_redraw_pane(c, wp); } c->flags &= ~CLIENT_REDRAWPANES; } @@ -1750,9 +1775,9 @@ server_client_check_redraw(struct client *c) screen_redraw_screen(c); } - tty->flags = (tty->flags & ~TTY_NOCURSOR) | (flags & TTY_NOCURSOR); + tty->flags = (tty->flags & ~TTY_NOCURSOR)|(flags & TTY_NOCURSOR); tty_update_mode(tty, mode, NULL); - tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR)) | flags; + tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR))|flags; c->flags &= ~(CLIENT_ALLREDRAWFLAGS|CLIENT_STATUSFORCE); |