Code

keyboard: move code to translate_key()
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 11:18:48 +0000 (12:18 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 11:18:48 +0000 (12:18 +0100)
src/keyboard.c

index c5d8c7814199781863188c7e892acfe3bca77ae6..da0b5a20e6fd2dcfc6f95666925746591593b277 100644 (file)
 
 #include <unistd.h>
 
+gcc_pure
 static command_t
-get_keyboard_command(void)
+translate_key(int key)
 {
-       int key = wgetch(stdscr);
        if (key == ERR || key == '\0')
                return CMD_NONE;
 
@@ -42,6 +42,12 @@ get_keyboard_command(void)
        return get_key_command(key);
 }
 
+static command_t
+get_keyboard_command(void)
+{
+       return translate_key(wgetch(stdscr));
+}
+
 static gboolean
 keyboard_event(gcc_unused GIOChannel *source,
               gcc_unused GIOCondition condition,