From 706a64c7a0f16f24bb845278086569d6cbe4ee6f Mon Sep 17 00:00:00 2001 From: braph Date: Thu, 26 Sep 2019 21:01:50 +0200 Subject: [PATCH] alsamixer: Fix window_size_changed() Obtaining the new window size using TIOCGWINSZ and setting it using resize_term(), so getmaxyx() reports the actual terminal size. Signed-off-by: Benjamin Abendroth Signed-off-by: Jaroslav Kysela --- alsamixer/widget.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/alsamixer/widget.c b/alsamixer/widget.c index 464f440..6f1644a 100644 --- a/alsamixer/widget.c +++ b/alsamixer/widget.c @@ -19,6 +19,8 @@ #include "aconfig.h" #include #include +#include +#include #include "die.h" #include "widget.h" @@ -127,6 +129,10 @@ void window_size_changed(void) { PANEL *panel, *below; const struct widget *widget; + struct winsize size; + + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &size) == 0) + resize_term(size.ws_row, size.ws_col); getmaxyx(stdscr, screen_lines, screen_cols); if (tigetflag("xenl") != 1 && tigetflag("am") != 1)