Code

command: move get_keyboard_command() to keyboard.c
authorMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 11:02:33 +0000 (12:02 +0100)
committerMax Kellermann <max.kellermann@gmail.com>
Mon, 20 Mar 2017 11:10:19 +0000 (12:10 +0100)
src/command.c
src/command.h
src/keyboard.c
src/keyboard.h
src/screen_find.c

index 889ef0ddff95be93d7bb2317ff612b3267a62f76..f903165f57a113034df735373395a4a5a3d43a7f 100644 (file)
@@ -436,21 +436,6 @@ get_key_command(int key)
        return find_key_command(key, cmds);
 }
 
-command_t
-get_keyboard_command(void)
-{
-       int key = wgetch(stdscr);
-       if (key == ERR || key == '\0')
-               return CMD_NONE;
-
-#ifdef HAVE_GETMOUSE
-       if (key == KEY_MOUSE)
-               return CMD_MOUSE_EVENT;
-#endif
-
-       return get_key_command(key);
-}
-
 bool
 assign_keys(command_t command, int keys[MAX_COMMAND_KEYS])
 {
index 3545214607f8b382c9e6a687267f7bce3905a697..1d6b6babcf8721b02ed1f97a0017d368bab2ba18 100644 (file)
@@ -179,6 +179,4 @@ get_key_command_from_name(const char *name);
 bool
 assign_keys(command_t command, int keys[MAX_COMMAND_KEYS]);
 
-command_t get_keyboard_command(void);
-
 #endif
index 5bd43e573ab3e173b26542ccbf676418068cf778..80a1eeeae16f41e199fa11dab8cb73ba8216ecd9 100644 (file)
 #include "keyboard.h"
 #include "command.h"
 #include "ncmpc.h"
+#include "ncmpc_curses.h"
 #include "Compiler.h"
 
 #include <glib.h>
 
 #include <unistd.h>
 
+command_t
+get_keyboard_command(void)
+{
+       int key = wgetch(stdscr);
+       if (key == ERR || key == '\0')
+               return CMD_NONE;
+
+#ifdef HAVE_GETMOUSE
+       if (key == KEY_MOUSE)
+               return CMD_MOUSE_EVENT;
+#endif
+
+       return get_key_command(key);
+}
+
 static gboolean
 keyboard_event(gcc_unused GIOChannel *source,
               gcc_unused GIOCondition condition,
index dfafa92fc64c7f449c087bc8cd965cb5fdd2f10a..ea888e5244a9983d7dce69ff558206b4c135b1b8 100644 (file)
 #ifndef KEYBOARD_H
 #define KEYBOARD_H
 
+#include "command.h"
+
 void
 keyboard_init(void);
 
+command_t
+get_keyboard_command(void);
+
 #endif
index 06365b50e53c5bdbd9cad2aea37ab7db9922ef3f..2427801274c5cbdb2c32854474689e228ac18cd4 100644 (file)
@@ -21,6 +21,7 @@
 #include "screen_utils.h"
 #include "screen_status.h"
 #include "screen.h"
+#include "keyboard.h"
 #include "i18n.h"
 #include "options.h"
 #include "ncmpc.h"