all just use the three flags together (window, borders, status).
-/* $OpenBSD: screen-redraw.c,v 1.52 2018/08/18 16:14:03 nicm Exp $ */
+/* $OpenBSD: screen-redraw.c,v 1.53 2018/08/19 16:45:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
static void
screen_redraw_draw_pane_status(struct screen_redraw_ctx *ctx)
{
- struct client *c = ctx->c;
+ struct client *c = ctx->c;
struct window *w = c->session->curw->window;
struct options *oo = c->session->options;
struct tty *tty = &c->tty;
}
/* Update status line and change flags if unchanged. */
-void
+static void
screen_redraw_update(struct client *c)
{
struct window *w = c->session->curw->window;
else
redraw = status_redraw(c);
if (!redraw)
- c->flags &= ~CLIENT_STATUS;
+ c->flags &= ~CLIENT_REDRAWSTATUS;
if (options_get_number(wo, "pane-border-status") != CELL_STATUS_OFF) {
redraw = 0;
redraw = 1;
}
if (redraw)
- c->flags |= CLIENT_BORDERS;
+ c->flags |= CLIENT_REDRAWBORDERS;
}
}
static void
screen_redraw_set_context(struct client *c, struct screen_redraw_ctx *ctx)
{
- struct session *s = c->session;
- struct options *oo = s->options;
- struct window *w = s->curw->window;
- struct options *wo = w->options;
+ struct session *s = c->session;
+ struct options *oo = s->options;
+ struct window *w = s->curw->window;
+ struct options *wo = w->options;
memset(ctx, 0, sizeof *ctx);
ctx->c = c;
/* Redraw entire screen. */
void
-screen_redraw_screen(struct client *c, int draw_panes, int draw_status,
- int draw_borders)
+screen_redraw_screen(struct client *c)
{
- struct screen_redraw_ctx ctx;
+ struct screen_redraw_ctx ctx;
if (c->flags & CLIENT_SUSPENDED)
return;
+ screen_redraw_update(c);
screen_redraw_set_context(c, &ctx);
- if (ctx.lines == 0)
- draw_status = 0;
-
- if (draw_borders)
+ if (c->flags & (CLIENT_REDRAWWINDOW|CLIENT_REDRAWBORDERS)) {
+ if (ctx.pane_status != CELL_STATUS_OFF)
+ screen_redraw_draw_pane_status(&ctx);
screen_redraw_draw_borders(&ctx);
- if (draw_borders && ctx.pane_status != CELL_STATUS_OFF)
- screen_redraw_draw_pane_status(&ctx);
- if (draw_panes)
+ }
+ if (c->flags & CLIENT_REDRAWWINDOW)
screen_redraw_draw_panes(&ctx);
- if (draw_status)
+ if (ctx.lines != 0 && (c->flags & CLIENT_REDRAWSTATUS))
screen_redraw_draw_status(&ctx);
tty_reset(&c->tty);
}
struct grid_cell *active_gc, struct grid_cell *m_other_gc,
struct grid_cell *other_gc)
{
- struct client *c = ctx->c;
- struct session *s = c->session;
- struct window *w = s->curw->window;
- struct tty *tty = &c->tty;
- struct window_pane *wp;
- struct window_pane *active = w->active;
- struct window_pane *marked = marked_pane.wp;
- u_int type;
- int flag, pane_status = ctx->pane_status;
+ struct client *c = ctx->c;
+ struct session *s = c->session;
+ struct window *w = s->curw->window;
+ struct tty *tty = &c->tty;
+ struct window_pane *wp;
+ struct window_pane *active = w->active;
+ struct window_pane *marked = marked_pane.wp;
+ u_int type;
+ int flag, pane_status = ctx->pane_status;
type = screen_redraw_check_cell(c, x, y, pane_status, &wp);
if (type == CELL_INSIDE)
struct tty *tty = &c->tty;
struct grid_cell m_active_gc, active_gc, m_other_gc, other_gc;
struct grid_cell msg_gc;
- u_int i, j, msgx = 0, msgy = 0;
+ u_int i, j, msgx = 0, msgy = 0;
int small, flags;
char msg[256];
const char *tmp;
struct window *w = c->session->curw->window;
struct tty *tty = &c->tty;
struct window_pane *wp;
- u_int i, y;
+ u_int i, y;
if (ctx->top)
y = ctx->lines;
-/* $OpenBSD: server-client.c,v 1.255 2018/08/18 20:08:52 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.256 2018/08/19 16:45:03 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
struct session *s = c->session;
struct tty *tty = &c->tty;
struct window_pane *wp;
- int needed, flags, masked;
+ int needed, flags;
struct timeval tv = { .tv_usec = 1000 };
static struct event ev;
size_t left;
* end up back here.
*/
needed = 0;
- if (c->flags & CLIENT_REDRAW)
+ if (c->flags & CLIENT_ALLREDRAWFLAGS)
needed = 1;
else {
TAILQ_FOREACH(wp, &c->session->curw->window->panes, entry) {
* We may have got here for a single pane redraw, but force a
* full redraw next time in case other panes have been updated.
*/
- c->flags |= CLIENT_REDRAW;
+ c->flags |= CLIENT_ALLREDRAWFLAGS;
return;
} else if (needed)
log_debug("%s: redraw needed", c->name);
- if (c->flags & (CLIENT_REDRAW|CLIENT_STATUS)) {
- if (options_get_number(s->options, "set-titles"))
- server_client_set_title(c);
- screen_redraw_update(c); /* will adjust flags */
- }
-
flags = tty->flags & (TTY_BLOCK|TTY_FREEZE|TTY_NOCURSOR);
tty->flags = (tty->flags & ~(TTY_BLOCK|TTY_FREEZE)) | TTY_NOCURSOR;
- if (c->flags & CLIENT_REDRAW) {
- tty_update_mode(tty, tty->mode, NULL);
- screen_redraw_screen(c, 1, 1, 1);
- c->flags &= ~(CLIENT_STATUS|CLIENT_BORDERS);
- } else {
+ 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) {
tty_update_mode(tty, tty->mode, NULL);
}
}
- masked = c->flags & (CLIENT_BORDERS|CLIENT_STATUS);
- if (masked != 0)
- tty_update_mode(tty, tty->mode, NULL);
- if (masked == CLIENT_BORDERS)
- screen_redraw_screen(c, 0, 0, 1);
- else if (masked == CLIENT_STATUS)
- screen_redraw_screen(c, 0, 1, 0);
- else if (masked != 0)
- screen_redraw_screen(c, 0, 1, 1);
+ if (c->flags & CLIENT_ALLREDRAWFLAGS) {
+ if (options_get_number(s->options, "set-titles"))
+ server_client_set_title(c);
+ screen_redraw_screen(c);
+ }
tty->flags = (tty->flags & ~(TTY_FREEZE|TTY_NOCURSOR)) | flags;
tty_update_mode(tty, tty->mode, NULL);
- c->flags &= ~(CLIENT_REDRAW|CLIENT_BORDERS|CLIENT_STATUS|
- CLIENT_STATUSFORCE);
+ c->flags &= ~(CLIENT_ALLREDRAWFLAGS|CLIENT_STATUSFORCE);
if (needed) {
/*
-/* $OpenBSD: server-fn.c,v 1.115 2018/08/18 20:08:52 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.116 2018/08/19 16:45:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
void
server_redraw_client(struct client *c)
{
- c->flags |= CLIENT_REDRAW;
+ c->flags |= CLIENT_ALLREDRAWFLAGS;
}
void
server_status_client(struct client *c)
{
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
}
void
TAILQ_FOREACH(c, &clients, entry) {
if (c->session != NULL && c->session->curw->window == w)
- c->flags |= CLIENT_BORDERS;
+ c->flags |= CLIENT_REDRAWBORDERS;
}
}
-/* $OpenBSD: status.c,v 1.176 2018/02/22 11:42:41 nicm Exp $ */
+/* $OpenBSD: status.c,v 1.177 2018/08/19 16:45:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
return;
if (c->message_string == NULL && c->prompt_string == NULL)
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
timerclear(&tv);
tv.tv_sec = options_get_number(s->options, "status-interval");
}
c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
}
/* Clear status line message. */
if (c->prompt_string == NULL)
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE);
- c->flags |= CLIENT_REDRAW; /* screen was frozen and may have changed */
+ c->flags |= CLIENT_ALLREDRAWFLAGS; /* was frozen and may have changed */
screen_reinit(&c->status.status);
}
if (~flags & PROMPT_INCREMENTAL)
c->tty.flags |= (TTY_NOCURSOR|TTY_FREEZE);
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
if ((flags & PROMPT_INCREMENTAL) && *tmp != '\0') {
xasprintf(&cp, "=%s", tmp);
c->prompt_buffer = NULL;
c->tty.flags &= ~(TTY_NOCURSOR|TTY_FREEZE);
- c->flags |= CLIENT_REDRAW; /* screen was frozen and may have changed */
+ c->flags |= CLIENT_ALLREDRAWFLAGS; /* was frozen and may have changed */
screen_reinit(&c->status.status);
}
c->prompt_hindex = 0;
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
free(tmp);
format_free(ft);
return (1);
case '\033': /* Escape */
c->prompt_mode = PROMPT_COMMAND;
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
return (0);
}
*new_key = key;
case 's':
case 'a':
c->prompt_mode = PROMPT_ENTRY;
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
break; /* switch mode and... */
case 'S':
c->prompt_mode = PROMPT_ENTRY;
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
*new_key = '\025'; /* C-u */
return (1);
case 'i':
case '\033': /* Escape */
c->prompt_mode = PROMPT_ENTRY;
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
return (0);
}
goto append_key;
}
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
return (0);
append_key:
}
changed:
- c->flags |= CLIENT_STATUS;
+ c->flags |= CLIENT_REDRAWSTATUS;
if (c->prompt_flags & PROMPT_INCREMENTAL) {
s = utf8_tocstr(c->prompt_buffer);
xasprintf(&cp, "%c%s", prefix, s);
-/* $OpenBSD: tmux.h,v 1.839 2018/08/18 20:08:52 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.840 2018/08/19 16:45:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
#define CLIENT_TERMINAL 0x1
#define CLIENT_LOGIN 0x2
#define CLIENT_EXIT 0x4
-#define CLIENT_REDRAW 0x8
-#define CLIENT_STATUS 0x10
+#define CLIENT_REDRAWWINDOW 0x8
+#define CLIENT_REDRAWSTATUS 0x10
#define CLIENT_REPEAT 0x20
#define CLIENT_SUSPENDED 0x40
#define CLIENT_ATTACHED 0x80
#define CLIENT_IDENTIFY 0x100
#define CLIENT_DEAD 0x200
-#define CLIENT_BORDERS 0x400
+#define CLIENT_REDRAWBORDERS 0x400
#define CLIENT_READONLY 0x800
#define CLIENT_DETACHING 0x1000
#define CLIENT_CONTROL 0x2000
#define CLIENT_TRIPLECLICK 0x200000
#define CLIENT_SIZECHANGED 0x400000
#define CLIENT_STATUSOFF 0x800000
+#define CLIENT_ALLREDRAWFLAGS \
+ (CLIENT_REDRAWWINDOW|CLIENT_REDRAWSTATUS|CLIENT_REDRAWBORDERS)
int flags;
struct key_table *keytable;
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
/* screen-redraw.c */
-void screen_redraw_update(struct client *);
-void screen_redraw_screen(struct client *, int, int, int);
+void screen_redraw_screen(struct client *);
void screen_redraw_pane(struct client *, struct window_pane *);
/* screen.c */
-/* $OpenBSD: tty.c,v 1.304 2018/08/18 16:14:03 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.305 2018/08/19 16:45:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
log_debug("%s: %zu discarded", c->name, tty->discarded);
- c->flags |= CLIENT_REDRAW;
+ c->flags |= CLIENT_ALLREDRAWFLAGS;
c->discarded += tty->discarded;
if (tty->discarded < TTY_BLOCK_STOP(tty)) {
{
if (c->session == NULL || c->tty.term == NULL)
return (0);
- if (c->flags & (CLIENT_REDRAW|CLIENT_SUSPENDED))
+ if (c->flags & (CLIENT_REDRAWWINDOW|CLIENT_SUSPENDED))
return (0);
if (c->tty.flags & TTY_FREEZE)
return (0);