summaryrefslogtreecommitdiff
path: root/src/fe-text/gui-readline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-text/gui-readline.c')
-rw-r--r--src/fe-text/gui-readline.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c
index 1cabfac7..0e1a1f31 100644
--- a/src/fe-text/gui-readline.c
+++ b/src/fe-text/gui-readline.c
@@ -134,17 +134,20 @@ static void window_next_page(void)
gui_window_scroll(active_win, get_scroll_count());
}
-void handle_key(unichar key)
+static void sig_gui_key_pressed(gpointer keyp)
{
+ unichar key;
char str[20];
- idle_time = time(NULL);
+ key = GPOINTER_TO_INT(keyp);
if (redir != NULL && redir->flags & ENTRY_REDIRECT_FLAG_HOTKEY) {
handle_key_redirect(key);
return;
}
+ idle_time = time(NULL);
+
if (key < 32) {
/* control key */
str[0] = '^';
@@ -367,8 +370,10 @@ static void sig_input(void)
if (!term_detached)
signal_emit("command quit", 1, "Lost terminal");
} else {
- for (i = 0; i < ret; i++)
- handle_key(buffer[i]);
+ for (i = 0; i < ret; i++) {
+ signal_emit("gui key pressed", 1,
+ GINT_TO_POINTER(buffer[i]));
+ }
}
}
@@ -762,6 +767,7 @@ void gui_readline_init(void)
signal_add("window changed automatic", (SIGNAL_FUNC) sig_window_auto_changed);
signal_add("gui entry redirect", (SIGNAL_FUNC) sig_gui_entry_redirect);
+ signal_add("gui key pressed", (SIGNAL_FUNC) sig_gui_key_pressed);
}
void gui_readline_deinit(void)
@@ -825,4 +831,5 @@ void gui_readline_deinit(void)
signal_remove("window changed automatic", (SIGNAL_FUNC) sig_window_auto_changed);
signal_remove("gui entry redirect", (SIGNAL_FUNC) sig_gui_entry_redirect);
+ signal_remove("gui key pressed", (SIGNAL_FUNC) sig_gui_key_pressed);
}