From 072567e1e5cc611526f384216311a6fede4de07f Mon Sep 17 00:00:00 2001 From: bernd Date: Mon, 21 Jul 2008 07:53:03 +0000 Subject: [PATCH] Add a sigwinch handler so ncmpc will resize on xterm resize. From Tobias Ulmer (MAINTAINER) ok jasper@ --- audio/ncmpc/Makefile | 8 +++--- audio/ncmpc/patches/patch-src_main_c | 33 +++++++++++++++++++++++ audio/ncmpc/patches/patch-src_screen_c | 37 ++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 audio/ncmpc/patches/patch-src_main_c create mode 100644 audio/ncmpc/patches/patch-src_screen_c diff --git a/audio/ncmpc/Makefile b/audio/ncmpc/Makefile index 62a0ec69da9..4cbfc66000a 100644 --- a/audio/ncmpc/Makefile +++ b/audio/ncmpc/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.8 2007/10/31 06:34:55 jasper Exp $ +# $OpenBSD: Makefile,v 1.9 2008/07/21 07:53:03 bernd Exp $ # mips64 architecture does not support trampoline code yet NOT_FOR_ARCHS= mips64 @@ -6,7 +6,7 @@ NOT_FOR_ARCHS= mips64 COMMENT= curses based frontend for mpd DISTNAME= ncmpc-20070917 -PKGNAME= ${DISTNAME}p0 +PKGNAME= ${DISTNAME}p1 CATEGORIES= audio HOMEPAGE= http://hem.bredband.net/kaw/ncmpc/ @@ -33,7 +33,7 @@ MASTER_SITES= http://humppa.nl/distfiles/ CONFIGURE_STYLE= gnu AUTOMAKE_VERSION= 1.8 -AUTOCONF_VERSION= 2.59 +AUTOCONF_VERSION= 2.61 CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ LDFLAGS="-L${LOCALBASE}/lib" @@ -41,7 +41,7 @@ CFLAGS+= -ftrampolines WRKDIST= ${WRKDIR}/ncmpc -post-patch: +pre-configure: cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \ AUTOMAKE_VERSION=${AUTOMAKE_VERSION} ./autogen.sh diff --git a/audio/ncmpc/patches/patch-src_main_c b/audio/ncmpc/patches/patch-src_main_c new file mode 100644 index 00000000000..8c9cd54b631 --- /dev/null +++ b/audio/ncmpc/patches/patch-src_main_c @@ -0,0 +1,33 @@ +$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); + } + diff --git a/audio/ncmpc/patches/patch-src_screen_c b/audio/ncmpc/patches/patch-src_screen_c new file mode 100644 index 00000000000..c67bd83bf91 --- /dev/null +++ b/audio/ncmpc/patches/patch-src_screen_c @@ -0,0 +1,37 @@ +$OpenBSD: patch-src_screen_c,v 1.1 2008/07/21 07:53:03 bernd Exp $ +--- src/screen.c.orig Wed Sep 19 19:27:39 2007 ++++ src/screen.c Sat Jul 12 10:53:09 2008 +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -449,13 +450,22 @@ void + screen_resize(void) + { + gint i; ++ struct winsize ws; + ++ if (ioctl(fileno(stdout), TIOCGWINSZ, &ws) == 0) { ++ LINES = ws.ws_row; ++ COLS = ws.ws_col; ++ } ++ + D("Resize rows %d->%d, cols %d->%d\n",screen->rows,LINES,screen->cols,COLS); + if( COLS