From: Max Kellermann Date: Mon, 20 Mar 2017 11:02:33 +0000 (+0100) Subject: command: move get_keyboard_command() to keyboard.c X-Git-Tag: v0.26~13 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f8ec4691bb5350fb321fcfe7dd8d73d1c441d569;p=ncmpc.git command: move get_keyboard_command() to keyboard.c --- diff --git a/src/command.c b/src/command.c index 889ef0d..f903165 100644 --- a/src/command.c +++ b/src/command.c @@ -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]) { diff --git a/src/command.h b/src/command.h index 3545214..1d6b6ba 100644 --- a/src/command.h +++ b/src/command.h @@ -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 diff --git a/src/keyboard.c b/src/keyboard.c index 5bd43e5..80a1eee 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -20,12 +20,28 @@ #include "keyboard.h" #include "command.h" #include "ncmpc.h" +#include "ncmpc_curses.h" #include "Compiler.h" #include #include +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, diff --git a/src/keyboard.h b/src/keyboard.h index dfafa92..ea888e5 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -20,7 +20,12 @@ #ifndef KEYBOARD_H #define KEYBOARD_H +#include "command.h" + void keyboard_init(void); +command_t +get_keyboard_command(void); + #endif diff --git a/src/screen_find.c b/src/screen_find.c index 06365b5..2427801 100644 --- a/src/screen_find.c +++ b/src/screen_find.c @@ -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"