summaryrefslogtreecommitdiff
path: root/alsamixer
diff options
context:
space:
mode:
authorbraph <braph93@gmx.de>2019-09-26 21:01:50 +0200
committerJaroslav Kysela <perex@perex.cz>2020-07-01 16:10:35 +0200
commit706a64c7a0f16f24bb845278086569d6cbe4ee6f (patch)
treea11797121c77b92647e268db65fac64f9f087f94 /alsamixer
parent225a9afbc3d7f244e10128f8c5c9335b8d361168 (diff)
downloadalsa-utils-706a64c7a0f16f24bb845278086569d6cbe4ee6f.tar.gz
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 <braph93@gmx.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'alsamixer')
-rw-r--r--alsamixer/widget.c6
1 files changed, 6 insertions, 0 deletions
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 <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)