summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <benjaminfranzke@googlemail.com>2010-07-23 02:39:09 +0200
committerben <benjaminfranzke@googlemail.com>2010-07-23 02:42:48 +0200
commita92bdc60e751083f0a989558e73213ad9baffdd8 (patch)
treee2c2d6c9bd21cfd08b16de8b51d675ff388a13f4
parent0b5229101775b78b0d398a4688fd289063f50abd (diff)
downloadpa-sink-ctl-a92bdc60e751083f0a989558e73213ad9baffdd8.tar.gz
pa-sink-ctl-a92bdc60e751083f0a989558e73213ad9baffdd8.tar.bz2
pa-sink-ctl-a92bdc60e751083f0a989558e73213ad9baffdd8.zip
use sigaction instead of signal
-rw-r--r--src/interface.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/interface.c b/src/interface.c
index 6794fc5..f78862a 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -1,3 +1,4 @@
+#define _POSIX_SOURCE
#include <signal.h>
#include <unistd.h>
#include <sys/ioctl.h>
@@ -26,19 +27,12 @@ static gint chooser_sink;
static gint chooser_input;
static guint32 selected_index;
-static void resize(gint signal);
-
-static void set_resize_callback(void)
-{
- signal(SIGWINCH, resize);
-}
-
-static void resize(gint signal)
+static void _resize(gint signal)
{
static gboolean resize_running = FALSE;
static gboolean resize_pending = FALSE;
- set_resize_callback();
+ sigaction(SIGWINCH, &(struct sigaction){_resize}, NULL);
if (resize_running) {
resize_pending = TRUE;
@@ -62,7 +56,7 @@ void interface_init(void)
clear();
noecho();
- cbreak(); /* Line buffering disabled. pass on everything */
+ cbreak(); /* Line buffering disabled. pass on everything */
curs_set(0); /* hide cursor */
// 0,0,0,0 means fullscreen
@@ -72,8 +66,7 @@ void interface_init(void)
keypad(menu_win, TRUE);
mvwprintw(msg_win, 0, 0, "Use arrow keys to go up and down, Press enter to select a choice");
// resize the windows into the correct form
- interface_resize();
- set_resize_callback();
+ _resize(SIGWINCH);
refresh();
}