Check for keyboard line input outside function.

This commit is contained in:
Themaister 2014-05-12 22:40:59 +02:00
parent 9815dbbc42
commit e677b4c091
2 changed files with 3 additions and 7 deletions

View File

@ -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);

View File

@ -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);