summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6827c0b)
raw | patch | inline | side by side (parent: 6827c0b)
author | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 19:02:01 +0000 (20:02 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 19:02:01 +0000 (20:02 +0100) |
src/keyboard.c | patch | blob | history |
diff --git a/src/keyboard.c b/src/keyboard.c
index edf7e61a6c5536fe2fdcfbe0fa37351b695c7b7a..e2234f3cee8a7e2373cce1d9af6da82b385f1164 100644 (file)
--- a/src/keyboard.c
+++ b/src/keyboard.c
static command_t
translate_key(int key)
{
- if (ignore_key(key))
- return CMD_NONE;
-
#ifdef HAVE_GETMOUSE
if (key == KEY_MOUSE)
return CMD_MOUSE_EVENT;
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,
gcc_unused gpointer data)
{
+ int key = wgetch(screen.main_window.w);
+ if (ignore_key(key))
+ return true;
+
+ command_t cmd = translate_key(key);
+ if (cmd == CMD_NONE)
+ return true;
+
begin_input_event();
- command_t cmd = get_keyboard_command();
- if (cmd != CMD_NONE)
- if (!do_input_event(cmd))
- return FALSE;
+ if (!do_input_event(cmd))
+ return FALSE;
end_input_event();
return TRUE;
void
keyboard_unread(int key)
{
+ if (ignore_key(key))
+ return;
+
command_t cmd = translate_key(key);
if (cmd != CMD_NONE)
do_input_event(cmd);