summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f8ec469)
raw | patch | inline | side by side (parent: f8ec469)
author | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 11:14:54 +0000 (12:14 +0100) | ||
committer | Max Kellermann <max.kellermann@gmail.com> | |
Mon, 20 Mar 2017 11:14:54 +0000 (12:14 +0100) |
src/keyboard.c | patch | blob | history | |
src/keyboard.h | patch | blob | history | |
src/screen_find.c | patch | blob | history |
diff --git a/src/keyboard.c b/src/keyboard.c
index 80a1eeeae16f41e199fa11dab8cb73ba8216ecd9..c5d8c7814199781863188c7e892acfe3bca77ae6 100644 (file)
--- a/src/keyboard.c
+++ b/src/keyboard.c
#include <unistd.h>
-command_t
+static command_t
get_keyboard_command(void)
{
int key = wgetch(stdscr);
g_io_add_watch(channel, G_IO_IN, keyboard_event, NULL);
g_io_channel_unref(channel);
}
+
+void
+keyboard_unread(int key)
+{
+ ungetch(key);
+
+ command_t cmd = get_keyboard_command();
+ if (cmd != CMD_NONE)
+ do_input_event(cmd);
+}
diff --git a/src/keyboard.h b/src/keyboard.h
index ea888e5244a9983d7dce69ff558206b4c135b1b8..e34b9195d61172ed3dd77eac3846af22f9da3ee4 100644 (file)
--- a/src/keyboard.h
+++ b/src/keyboard.h
#ifndef KEYBOARD_H
#define KEYBOARD_H
-#include "command.h"
-
void
keyboard_init(void);
-command_t
-get_keyboard_command(void);
+void
+keyboard_unread(int key);
#endif
diff --git a/src/screen_find.c b/src/screen_find.c
index 2427801274c5cbdb2c32854474689e228ac18cd4..b838421f4f94eadae78b382a7f086ec656f44925 100644 (file)
--- a/src/screen_find.c
+++ b/src/screen_find.c
wrefresh(lw->w);
}
- /* ncmpc should get the command */
- ungetch(key);
-
- command_t cmd;
- if ((cmd=get_keyboard_command()) != CMD_NONE)
- do_input_event(cmd);
-
char *temp = g_strdup(search_str);
g_free(screen.findbuf);
screen.findbuf = temp;
+
+ /* ncmpc should get the command */
+ keyboard_unread(key);
}