Add a flag to redraw only the overlay, and remove the overlay on resize.

This commit is contained in:
nicm 2019-05-08 18:07:12 +00:00
parent a384245c5a
commit f9682d2e55
4 changed files with 13 additions and 5 deletions

View File

@ -18,7 +18,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -447,7 +447,7 @@ screen_redraw_screen(struct client *c)
if (ctx.statuslines != 0 && if (ctx.statuslines != 0 &&
(flags & (CLIENT_REDRAWSTATUS|CLIENT_REDRAWSTATUSALWAYS))) (flags & (CLIENT_REDRAWSTATUS|CLIENT_REDRAWSTATUSALWAYS)))
screen_redraw_draw_status(&ctx); screen_redraw_draw_status(&ctx);
if (c->overlay_draw != NULL) if (c->overlay_draw != NULL && (flags & CLIENT_REDRAWOVERLAY))
c->overlay_draw(c, &ctx); c->overlay_draw(c, &ctx);
tty_reset(&c->tty); tty_reset(&c->tty);
} }

View File

@ -79,6 +79,9 @@ server_client_set_overlay(struct client *c, u_int delay, overlay_draw_cb drawcb,
{ {
struct timeval tv; struct timeval tv;
if (c->overlay_draw != NULL)
server_client_clear_overlay(c);
tv.tv_sec = delay / 1000; tv.tv_sec = delay / 1000;
tv.tv_usec = (delay % 1000) * 1000L; tv.tv_usec = (delay % 1000) * 1000L;
@ -1433,6 +1436,8 @@ server_client_reset_state(struct client *c)
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return; return;
if (c->overlay_draw != NULL)
return;
mode = s->mode; mode = s->mode;
tty_region_off(&c->tty); tty_region_off(&c->tty);
@ -1543,10 +1548,11 @@ server_client_check_redraw(struct client *c)
if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED))
return; return;
if (c->flags & CLIENT_ALLREDRAWFLAGS) { 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_REDRAWWINDOW) ? " window" : "",
(c->flags & CLIENT_REDRAWSTATUS) ? " status" : "", (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) if (c->flags & CLIENT_CONTROL)
break; break;
server_client_clear_overlay(c);
tty_resize(&c->tty); tty_resize(&c->tty);
recalculate_sizes(); recalculate_sizes();
server_redraw_client(c); server_redraw_client(c);

4
tmux.h
View File

@ -1458,11 +1458,13 @@ struct client {
#define CLIENT_SIZECHANGED 0x400000 #define CLIENT_SIZECHANGED 0x400000
#define CLIENT_STATUSOFF 0x800000 #define CLIENT_STATUSOFF 0x800000
#define CLIENT_REDRAWSTATUSALWAYS 0x1000000 #define CLIENT_REDRAWSTATUSALWAYS 0x1000000
#define CLIENT_REDRAWOVERLAY 0x2000000
#define CLIENT_ALLREDRAWFLAGS \ #define CLIENT_ALLREDRAWFLAGS \
(CLIENT_REDRAWWINDOW| \ (CLIENT_REDRAWWINDOW| \
CLIENT_REDRAWSTATUS| \ CLIENT_REDRAWSTATUS| \
CLIENT_REDRAWSTATUSALWAYS| \ CLIENT_REDRAWSTATUSALWAYS| \
CLIENT_REDRAWBORDERS) CLIENT_REDRAWBORDERS| \
CLIENT_REDRAWOVERLAY)
#define CLIENT_NOSIZEFLAGS \ #define CLIENT_NOSIZEFLAGS \
(CLIENT_DEAD| \ (CLIENT_DEAD| \
CLIENT_SUSPENDED| \ CLIENT_SUSPENDED| \