From 067604bf8cb23c1a208d26d94dbae7c2ab46dabf Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 28 Nov 2019 09:05:34 +0000 Subject: Store xpixel/ypixel from TIOCGWINSZ and add formats. --- tty.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index d77bb440..9efd78a0 100644 --- a/tty.c +++ b/tty.c @@ -127,29 +127,40 @@ tty_resize(struct tty *tty) { struct client *c = tty->client; struct winsize ws; - u_int sx, sy; + u_int sx, sy, xpixel, ypixel; if (ioctl(tty->fd, TIOCGWINSZ, &ws) != -1) { sx = ws.ws_col; - if (sx == 0) + if (sx == 0) { sx = 80; + xpixel = 0; + } else + xpixel = ws.ws_xpixel / sx; sy = ws.ws_row; - if (sy == 0) + if (sy == 0) { sy = 24; + ypixel = 0; + } else + ypixel = ws.ws_ypixel / sy; } else { sx = 80; sy = 24; + xpixel = 0; + ypixel = 0; } - log_debug("%s: %s now %ux%u", __func__, c->name, sx, sy); - tty_set_size(tty, sx, sy); + log_debug("%s: %s now %ux%u (%ux%u)", __func__, c->name, sx, sy, + xpixel, ypixel); + tty_set_size(tty, sx, sy, xpixel, ypixel); tty_invalidate(tty); } void -tty_set_size(struct tty *tty, u_int sx, u_int sy) +tty_set_size(struct tty *tty, u_int sx, u_int sy, u_int xpixel, u_int ypixel) { tty->sx = sx; tty->sy = sy; + tty->xpixel = xpixel; + tty->ypixel = ypixel; } static void -- cgit From bc5881c4d2fe0d9172636cfb2d756372995c8359 Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 28 Nov 2019 09:56:25 +0000 Subject: Long lines and spacing fixes. --- tty.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tty.c') diff --git a/tty.c b/tty.c index 9efd78a0..594f02fa 100644 --- a/tty.c +++ b/tty.c @@ -2454,7 +2454,8 @@ tty_check_bg(struct tty *tty, struct window_pane *wp, struct grid_cell *gc) } static void -tty_check_us(__unused struct tty *tty, struct window_pane *wp, struct grid_cell *gc) +tty_check_us(__unused struct tty *tty, struct window_pane *wp, + struct grid_cell *gc) { int c; -- cgit