diff options
author | Timo Sirainen <cras@irssi.org> | 2003-11-17 12:17:57 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2003-11-17 12:17:57 +0000 |
commit | 4d3d559f93abd3e9d326e8ad356fbb88a9a0487c (patch) | |
tree | 6957023d6bc77bab9f3ea43879d4865593588b00 /src/fe-common/core | |
parent | 89a210ff43a4f0cd2b6707979f9a749080e2d613 (diff) | |
download | irssi-4d3d559f93abd3e9d326e8ad356fbb88a9a0487c.zip |
paste detection fixes
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3169 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core')
-rw-r--r-- | src/fe-common/core/keyboard.c | 10 | ||||
-rw-r--r-- | src/fe-common/core/keyboard.h | 5 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/fe-common/core/keyboard.c b/src/fe-common/core/keyboard.c index 9bbb218a..f117c76f 100644 --- a/src/fe-common/core/keyboard.c +++ b/src/fe-common/core/keyboard.c @@ -551,8 +551,6 @@ static int key_states_search(const unsigned char *combo, return 0; } -/* Returns TRUE if key press was consumed. Control characters should be sent - as "^@" .. "^_" instead of #0..#31 chars, #127 should be sent as ^? */ int key_pressed(KEYBOARD_REC *keyboard, const char *key) { KEY_REC *rec; @@ -565,7 +563,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) if (keyboard->key_state == NULL && key[1] == '\0' && !used_keys[(int) (unsigned char) key[0]]) { /* fast check - key not used */ - return FALSE; + return -1; } first_key = keyboard->key_state == NULL; @@ -583,13 +581,13 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) /* unknown key combo, eat the invalid key unless it was the first key pressed */ g_free(combo); - return !first_key; + return first_key ? 0 : -1; } if (g_tree_lookup(key_states, combo) != rec) { /* key combo continues.. */ keyboard->key_state = combo; - return TRUE; + return 0; } /* finished key combo, execute */ @@ -597,7 +595,7 @@ int key_pressed(KEYBOARD_REC *keyboard, const char *key) consumed = key_emit_signal(keyboard, rec); /* never consume non-control characters */ - return consumed; + return consumed ? 1 : -1; } void keyboard_entry_redirect(SIGNAL_FUNC func, const char *entry, diff --git a/src/fe-common/core/keyboard.h b/src/fe-common/core/keyboard.h index eff8966a..970dc7b7 100644 --- a/src/fe-common/core/keyboard.h +++ b/src/fe-common/core/keyboard.h @@ -29,8 +29,9 @@ extern GSList *keyinfos; KEYBOARD_REC *keyboard_create(void *gui_data); /* Destroys a keyboard */ void keyboard_destroy(KEYBOARD_REC *keyboard); -/* Returns TRUE if key press was consumed. Control characters should be sent - as "^@" .. "^_" instead of #0..#31 chars, #127 should be sent as ^? */ +/* Returns 1 if key press was consumed, -1 if not, 0 if it's beginning of a + key combo. Control characters should be sent as "^@" .. "^_" instead of + #0..#31 chars, #127 should be sent as ^? */ int key_pressed(KEYBOARD_REC *keyboard, const char *key); void key_bind(const char *id, const char *description, |