]> git.alsa-project.org Git - alsa-utils.git/commitdiff
alsamixer: Fix window_size_changed()
authorbraph <braph93@gmx.de>
Thu, 26 Sep 2019 19:01:50 +0000 (21:01 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 1 Jul 2020 14:10:35 +0000 (16:10 +0200)
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 <braph93@gmx.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
alsamixer/widget.c

index 464f440e031ee295f5d141de4a2c5ebdd7317cb7..6f1644a42008c064706413c9a508bcbcd562ada4 100644 (file)
@@ -19,6 +19,8 @@
 #include "aconfig.h"
 #include <stdlib.h>
 #include <term.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
 #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)