Add a sigwinch handler so ncmpc will resize on xterm resize.
From Tobias Ulmer (MAINTAINER) ok jasper@
This commit is contained in:
parent
523a6e9011
commit
072567e1e5
@ -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
|
||||
|
||||
|
33
audio/ncmpc/patches/patch-src_main_c
Normal file
33
audio/ncmpc/patches/patch-src_main_c
Normal file
@ -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);
|
||||
}
|
||||
|
37
audio/ncmpc/patches/patch-src_screen_c
Normal file
37
audio/ncmpc/patches/patch-src_screen_c
Normal file
@ -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 <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
+#include <termios.h>
|
||||
#include <locale.h>
|
||||
#include <glib.h>
|
||||
#include <ncurses.h>
|
||||
@@ -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<SCREEN_MIN_COLS || LINES<SCREEN_MIN_ROWS )
|
||||
{
|
||||
- screen_exit();
|
||||
- fprintf(stderr, _("Error: Screen to small!\n"));
|
||||
- exit(EXIT_FAILURE);
|
||||
+ /*
|
||||
+ * Do not resize under a certain minimum, because that will fuck up the
|
||||
+ * playlist amongst other things
|
||||
+ */
|
||||
+ LINES = SCREEN_MIN_ROWS;
|
||||
+ COLS = SCREEN_MIN_COLS;
|
||||
}
|
||||
|
||||
resizeterm(LINES, COLS);
|
Loading…
Reference in New Issue
Block a user