openbsd-ports/audio/ncmpc/patches/patch-src_main_c
bernd 072567e1e5 Add a sigwinch handler so ncmpc will resize on xterm resize.
From Tobias Ulmer (MAINTAINER)

ok jasper@
2008-07-21 07:53:03 +00:00

34 lines
732 B
Plaintext

$OpenBSD: patch-src_main_c,v 1.1 2008/07/21 07:53:03 bernd Exp $
--- src/main.c.orig Wed Sep 19 19:27:39 2007
+++ src/main.c Sat Jul 12 10:45:07 2008
@@ -153,6 +153,13 @@ sigstop(void)
kill(0, SIGSTOP); /* issue SIGSTOP */
}
+void
+catch_sigwinch(int x)
+{
+ (void)x;
+ screen_resize();
+}
+
#ifdef DEBUG
void
D(char *format, ...)
@@ -237,6 +244,15 @@ main(int argc, const char *argv[])
if( sigaction(SIGCONT, &act, NULL)<0 )
{
perror("sigaction(SIGCONT)");
+ exit(EXIT_FAILURE);
+ }
+
+ sigemptyset(&act.sa_mask);
+ act.sa_flags = 0;
+ act.sa_handler = catch_sigwinch;
+ if( sigaction(SIGWINCH, &act, NULL)<0 )
+ {
+ perror("sigaction(SIGWINCH)");
exit(EXIT_FAILURE);
}