From: braph Date: Thu, 26 Sep 2019 19:01:50 +0000 (+0200) Subject: alsamixer: Fix window_size_changed() X-Git-Tag: v1.2.4~22 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=706a64c7a0f16f24bb845278086569d6cbe4ee6f;p=alsa-utils.git 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 --- 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)