Code

use the glib main event loop
[ncmpc.git] / src / command.c
index 881df278a241f58ac6af0f83485441596fa2af68..151d46535f94a7df086a63d05eac1db2636e7d7a 100644 (file)
@@ -30,6 +30,7 @@
 #include <ctype.h>
 #include <glib.h>
 #include <signal.h>
+#include <unistd.h>
 
 #undef DEBUG_KEYS
 
@@ -420,23 +421,18 @@ my_wgetch(WINDOW *w)
                sigstop();
        /* handle SIGINT (Ctrl-C) */
        if (c == 3)
-               exit(EXIT_SUCCESS);
+               kill(getpid(), SIGTERM);
 #endif
 
        return c;
 }
 
 command_t
-get_keyboard_command_with_timeout(int ms)
+get_keyboard_command(void)
 {
        int key;
 
-       if (ms != SCREEN_TIMEOUT)
-               timeout(ms);
        key = my_wgetch(stdscr);
-       if (ms != SCREEN_TIMEOUT)
-               timeout(SCREEN_TIMEOUT);
-
        if (key == ERR)
                return CMD_NONE;
 
@@ -448,12 +444,6 @@ get_keyboard_command_with_timeout(int ms)
        return get_key_command(key);
 }
 
-command_t
-get_keyboard_command(void)
-{
-       return get_keyboard_command_with_timeout(SCREEN_TIMEOUT);
-}
-
 int
 assign_keys(command_t command, int keys[MAX_COMMAND_KEYS])
 {