diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-10-20 08:45:01 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-10-20 08:54:57 +0200 |
commit | af293d4059ff1e0873d452d871d41b501ed1636a (patch) | |
tree | bd1bedd07106057981ff939715ee58d0d731f733 /src/interface.c | |
parent | 2d9ad6d33aabafa51f05598cce3eda72bf815da8 (diff) | |
download | pa-sink-ctl-af293d4059ff1e0873d452d871d41b501ed1636a.tar.gz pa-sink-ctl-af293d4059ff1e0873d452d871d41b501ed1636a.tar.bz2 pa-sink-ctl-af293d4059ff1e0873d452d871d41b501ed1636a.zip |
Kill off g_curses_input
Use a g_io_channel that listens to STDIN_FILENO instead.
Diffstat (limited to 'src/interface.c')
-rw-r--r-- | src/interface.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/interface.c b/src/interface.c index b0f221c..0513687 100644 --- a/src/interface.c +++ b/src/interface.c @@ -11,7 +11,6 @@ #include "pa-sink-ctl.h" #include "g_unix_signal.h" -#include "g_curses_input.h" #define H_MSG_BOX 3 @@ -182,13 +181,13 @@ print_sink_list(void) } static gboolean -interface_get_input(gpointer data) +interface_get_input(GIOChannel *source, GIOCondition condition, gpointer data) { gint c; gboolean volume_increment = TRUE; if (!context_ready) - return FALSE; + return TRUE; c = wgetch(menu_win); switch (c) { @@ -321,6 +320,7 @@ interface_get_input(gpointer data) quit(); break; } + return TRUE; } @@ -354,6 +354,8 @@ interface_set_status(const gchar *msg) void interface_init(void) { + GIOChannel *input_channel; + chooser_sink = 0; /* Selected sink-device. 0 is the first device */ chooser_input = SELECTED_SINK; /* Selected input of the current sink-device. */ /* SELECTED_SINK refers to sink-device itself */ @@ -378,8 +380,12 @@ interface_init(void) /* register event handler for resize and input */ resize_source_id = g_unix_signal_add(SIGWINCH, interface_resize, NULL); - input_source_id = g_curses_input_add(menu_win, interface_get_input, - NULL); + input_channel = g_io_channel_unix_new(STDIN_FILENO); + if (!input_channel) + exit(EXIT_FAILURE); + input_source_id = g_io_add_watch(input_channel, G_IO_IN, + interface_get_input, NULL); + g_io_channel_unref(input_channel); refresh(); } |