From 126dea8828ae33dd66b514a76b9960a5305eedc3 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 14 Oct 2026 08:33:19 +0000 Subject: [PATCH] Redraw when pixel sizes change. --- tmux.h | 4 ++-- tty-keys.c | 8 +++++--- tty.c | 10 ++++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/tmux.h b/tmux.h index aff0779ee..a52999a9e 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1459 2026/10/13 10:21:58 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1460 2026/10/14 08:33:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -2922,7 +2922,7 @@ void tty_cell(struct tty *, const struct grid_cell *, const struct tty_style_ctx *); int tty_init(struct tty *, struct client *); void tty_resize(struct tty *); -void tty_set_size(struct tty *, u_int, u_int, u_int, u_int); +int tty_set_size(struct tty *, u_int, u_int, u_int, u_int); void tty_invalidate(struct tty *); void tty_start_tty(struct tty *); void tty_send_requests(struct tty *); diff --git a/tty-keys.c b/tty-keys.c index b9ca2f019..f82d901ff 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-keys.c,v 1.217 2026/10/12 12:26:46 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.218 2026/10/14 08:33:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1914,7 +1914,8 @@ tty_keys_winsz(struct tty *tty, const char *buf, size_t len, size_t *size, return (0); /* Window size in characters. */ - tty_set_size(tty, sx, sy, tty->xpixel, tty->ypixel); + if (tty_set_size(tty, sx, sy, tty->xpixel, tty->ypixel)) + server_redraw_client(c); return (0); } else if (sscanf(tmp, "4;%u;%u", &ypixel, &xpixel) == 2) { *size = end + 1; @@ -1924,7 +1925,8 @@ tty_keys_winsz(struct tty *tty, const char *buf, size_t len, size_t *size, /* Window size in pixels. */ char_x = (xpixel && tty->sx) ? xpixel / tty->sx : 0; char_y = (ypixel && tty->sy) ? ypixel / tty->sy : 0; - tty_set_size(tty, tty->sx, tty->sy, char_x, char_y); + if (tty_set_size(tty, tty->sx, tty->sy, char_x, char_y)) + server_redraw_client(c); tty_invalidate(tty); tty->flags &= ~TTY_WINSIZEQUERY; diff --git a/tty.c b/tty.c index ad2853d42..b8531c7e6 100644 --- a/tty.c +++ b/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.486 2026/10/12 10:39:05 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.487 2026/10/14 08:33:19 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -155,13 +155,19 @@ tty_resize(struct tty *tty) tty_invalidate(tty); } -void +int tty_set_size(struct tty *tty, u_int sx, u_int sy, u_int xpixel, u_int ypixel) { + if (tty->sx == sx && + tty->sy == sy && + tty->xpixel == xpixel && + tty->ypixel == ypixel) + return (0); tty->sx = sx; tty->sy = sy; tty->xpixel = xpixel; tty->ypixel = ypixel; + return (1); } static void