aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2019-11-28 09:05:34 +0000
committernicm <nicm>2019-11-28 09:05:34 +0000
commit067604bf8cb23c1a208d26d94dbae7c2ab46dabf (patch)
treed8692a46c84f0bb155282f9208311f8f8646f9cd /tty.c
parent7fb8eec8f13bf54b3a6c06763d2cf0b29df51281 (diff)
downloadrtmux-067604bf8cb23c1a208d26d94dbae7c2ab46dabf.tar.gz
rtmux-067604bf8cb23c1a208d26d94dbae7c2ab46dabf.tar.bz2
rtmux-067604bf8cb23c1a208d26d94dbae7c2ab46dabf.zip
Store xpixel/ypixel from TIOCGWINSZ and add formats.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c23
1 files changed, 17 insertions, 6 deletions
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