diff --git a/src/keyboard.c b/src/keyboard.c
index c5d8c7814199781863188c7e892acfe3bca77ae6..5042af2a3648e9e0b1237e54b44de3fda42cb8a4 100644 (file)
--- a/src/keyboard.c
+++ b/src/keyboard.c
#include "command.h"
#include "ncmpc.h"
#include "ncmpc_curses.h"
+#include "screen.h"
#include "Compiler.h"
#include <glib.h>
#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;
return get_key_command(key);
}
+static command_t
+get_keyboard_command(void)
+{
+ return translate_key(wgetch(screen.main_window.w));
+}
+
static gboolean
keyboard_event(gcc_unused GIOChannel *source,
gcc_unused GIOCondition condition,
void
keyboard_unread(int key)
{
- ungetch(key);
-
- command_t cmd = get_keyboard_command();
+ command_t cmd = translate_key(key);
if (cmd != CMD_NONE)
do_input_event(cmd);
}