diff options
author | Timo Sirainen <cras@irssi.org> | 2002-11-05 13:34:31 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-11-05 13:34:31 +0000 |
commit | a0e8cfc9f524241adaf490ea920cde57b6a8a750 (patch) | |
tree | 1de53ca4092450a380df571ce260bc4de3157ddc /src | |
parent | 71442509d092e900c46997b6f4d2fcddfc876251 (diff) | |
download | irssi-a0e8cfc9f524241adaf490ea920cde57b6a8a750.zip |
Added "gui key pressed" signal which is sent every time a key is pressed.
The parameter is non-translated key received from terminal, so control keys
may create multiple keypress signals (eg. home == ESC, [, H).
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2985 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-text/gui-readline.c | 15 |
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); } |