Merge pull request #683 from orikad/master

fixed double key input on OS X
This commit is contained in:
Twinaphex 2014-05-12 22:35:40 +02:00
commit 9815dbbc42
2 changed files with 7 additions and 3 deletions

View File

@ -52,8 +52,12 @@ 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 input_keyboard_line_event(input_keyboard_line_t *state, uint32_t character, bool down)
{
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')
@ -147,7 +151,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))
if (input_keyboard_line_event(g_keyboard_line, character, down))
{
// 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 input_keyboard_line_event(input_keyboard_line_t *state, uint32_t character, bool down);
// 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);