From a92bdc60e751083f0a989558e73213ad9baffdd8 Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 23 Jul 2010 02:39:09 +0200 Subject: use sigaction instead of signal --- src/interface.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'src') 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 #include #include @@ -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(); } -- cgit