From e677b4c09137c3051803fa21259aaf7ae3919b20 Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 12 May 2014 22:40:59 +0200 Subject: [PATCH] Check for keyboard line input outside function. --- input/keyboard_line.c | 8 ++------ input/keyboard_line.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/input/keyboard_line.c b/input/keyboard_line.c index d2a139b097..bffbb59dd5 100644 --- a/input/keyboard_line.c +++ b/input/keyboard_line.c @@ -52,12 +52,8 @@ input_keyboard_line_t *input_keyboard_line_new(void *userdata, return state; } -bool input_keyboard_line_event(input_keyboard_line_t *state, uint32_t character, bool down) +bool input_keyboard_line_event(input_keyboard_line_t *state, uint32_t character) { - if (!down) - { - return false; - } // Treat extended chars as ? as we cannot support printable characters for unicode stuff. char c = character >= 128 ? '?' : character; if (c == '\r' || c == '\n') @@ -151,7 +147,7 @@ void input_keyboard_event(bool down, unsigned code, uint32_t character, uint16_t } else if (g_keyboard_line) { - if (input_keyboard_line_event(g_keyboard_line, character, down)) + if (down && input_keyboard_line_event(g_keyboard_line, character)) { // Line is complete, can free it now. input_keyboard_line_free(g_keyboard_line); diff --git a/input/keyboard_line.h b/input/keyboard_line.h index 598b261c18..a01e0eb08e 100644 --- a/input/keyboard_line.h +++ b/input/keyboard_line.h @@ -37,7 +37,7 @@ input_keyboard_line_t *input_keyboard_line_new(void *userdata, input_keyboard_line_complete_t cb); // Called on every keyboard character event. -bool input_keyboard_line_event(input_keyboard_line_t *state, uint32_t character, bool down); +bool input_keyboard_line_event(input_keyboard_line_t *state, uint32_t character); // Returns pointer to string. The underlying buffer can be reallocated at any time (or be NULL), but the pointer to it remains constant throughout the objects lifetime. const char **input_keyboard_line_get_buffer(const input_keyboard_line_t *state);