From f9682d2e558c58117f23f302ce35d9b319151189 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 8 May 2019 18:07:12 +0000 Subject: [PATCH] Add a flag to redraw only the overlay, and remove the overlay on resize. --- cmd-display-panes.c | 1 - screen-redraw.c | 2 +- server-client.c | 11 +++++++++-- tmux.h | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 45f59a6b..8940b429 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -18,7 +18,6 @@ #include -#include #include #include diff --git a/screen-redraw.c b/screen-redraw.c index 5278e776..dbae11b7 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -447,7 +447,7 @@ screen_redraw_screen(struct client *c) if (ctx.statuslines != 0 && (flags & (CLIENT_REDRAWSTATUS|CLIENT_REDRAWSTATUSALWAYS))) screen_redraw_draw_status(&ctx); - if (c->overlay_draw != NULL) + if (c->overlay_draw != NULL && (flags & CLIENT_REDRAWOVERLAY)) c->overlay_draw(c, &ctx); tty_reset(&c->tty); } diff --git a/server-client.c b/server-client.c index 9e986d4d..dc1f3939 100644 --- a/server-client.c +++ b/server-client.c @@ -79,6 +79,9 @@ server_client_set_overlay(struct client *c, u_int delay, overlay_draw_cb drawcb, { struct timeval tv; + if (c->overlay_draw != NULL) + server_client_clear_overlay(c); + tv.tv_sec = delay / 1000; tv.tv_usec = (delay % 1000) * 1000L; @@ -1433,6 +1436,8 @@ server_client_reset_state(struct client *c) if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) return; + if (c->overlay_draw != NULL) + return; mode = s->mode; tty_region_off(&c->tty); @@ -1543,10 +1548,11 @@ server_client_check_redraw(struct client *c) if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) return; if (c->flags & CLIENT_ALLREDRAWFLAGS) { - log_debug("%s: redraw%s%s%s", c->name, + log_debug("%s: redraw%s%s%s%s", c->name, (c->flags & CLIENT_REDRAWWINDOW) ? " window" : "", (c->flags & CLIENT_REDRAWSTATUS) ? " status" : "", - (c->flags & CLIENT_REDRAWBORDERS) ? " borders" : ""); + (c->flags & CLIENT_REDRAWBORDERS) ? " borders" : "", + (c->flags & CLIENT_REDRAWOVERLAY) ? " overlay" : ""); } /* @@ -1702,6 +1708,7 @@ server_client_dispatch(struct imsg *imsg, void *arg) if (c->flags & CLIENT_CONTROL) break; + server_client_clear_overlay(c); tty_resize(&c->tty); recalculate_sizes(); server_redraw_client(c); diff --git a/tmux.h b/tmux.h index fb1da4a4..39b77341 100644 --- a/tmux.h +++ b/tmux.h @@ -1458,11 +1458,13 @@ struct client { #define CLIENT_SIZECHANGED 0x400000 #define CLIENT_STATUSOFF 0x800000 #define CLIENT_REDRAWSTATUSALWAYS 0x1000000 +#define CLIENT_REDRAWOVERLAY 0x2000000 #define CLIENT_ALLREDRAWFLAGS \ (CLIENT_REDRAWWINDOW| \ CLIENT_REDRAWSTATUS| \ CLIENT_REDRAWSTATUSALWAYS| \ - CLIENT_REDRAWBORDERS) + CLIENT_REDRAWBORDERS| \ + CLIENT_REDRAWOVERLAY) #define CLIENT_NOSIZEFLAGS \ (CLIENT_DEAD| \ CLIENT_SUSPENDED| \