From 37a4641a3df8a5fed8ad8afe2d56804a82503ca8 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 31 May 2017 10:29:15 +0000 Subject: [PATCH] It is not OK to ignore SIGWINCH if SIOCGWINSZ reports the size has unchanged, because it may have changed and changed back in the time between us getting the signal and calling ioctl(). Always redraw when we see SIGWINCH. --- usr.bin/tmux/server-client.c | 9 ++++----- usr.bin/tmux/tmux.h | 6 +++--- usr.bin/tmux/tty.c | 14 ++++---------- 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 94914eaf5da..0862a962e91 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.235 2017/05/31 10:15:51 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.236 2017/05/31 10:29:15 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -1451,10 +1451,9 @@ server_client_dispatch(struct imsg *imsg, void *arg) if (c->flags & CLIENT_CONTROL) break; - if (tty_resize(&c->tty)) { - recalculate_sizes(); - server_redraw_client(c); - } + tty_resize(&c->tty); + recalculate_sizes(); + server_redraw_client(c); if (c->session != NULL) notify_client("client-resized", c); break; diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index c9bba5b6b09..4253d4d96f7 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.777 2017/05/31 10:15:51 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.778 2017/05/31 10:29:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1661,8 +1661,8 @@ void tty_puts(struct tty *, const char *); void tty_putc(struct tty *, u_char); void tty_putn(struct tty *, const void *, size_t, u_int); int tty_init(struct tty *, struct client *, int, char *); -int tty_resize(struct tty *); -int tty_set_size(struct tty *, u_int, u_int); +void tty_resize(struct tty *); +void tty_set_size(struct tty *, u_int, u_int); void tty_start_tty(struct tty *); void tty_stop_tty(struct tty *); void tty_set_title(struct tty *, const char *); diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 1df7456c67c..c6836f2d075 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.286 2017/05/31 08:43:44 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.287 2017/05/31 10:29:15 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -120,7 +120,7 @@ tty_init(struct tty *tty, struct client *c, int fd, char *term) return (0); } -int +void tty_resize(struct tty *tty) { struct client *c = tty->client; @@ -139,21 +139,15 @@ tty_resize(struct tty *tty) sy = 24; } log_debug("%s: %s now %ux%u", __func__, c->name, sx, sy); - - if (!tty_set_size(tty, sx, sy)) - return (0); + tty_set_size(tty, sx, sy); tty_invalidate(tty); - return (1); } -int +void tty_set_size(struct tty *tty, u_int sx, u_int sy) { - if (sx == tty->sx && sy == tty->sy) - return (0); tty->sx = sx; tty->sy = sy; - return (1); } static void -- 2.20.1