GUI2: fixed a bug that's been causing SDL_KEY_DOWN events to be executed twice.

`SDL_TEXTINPUT` events were being handled after `SDL_KEYDOWN` events and calling the same `key_down` codepath,
result in any registered `SDL_KEY_DOWN` callbacks being executed twice, the second time around with null/0 'key'
data.
This commit is contained in:
Charles Dang 2017-03-15 22:14:49 +11:00
parent 3b361968ce
commit 585ce88d64

View file

@ -269,13 +269,6 @@ private:
const SDL_Keymod modifier,
const utf8::string& unicode);
/**
* Fires a text input event.
*
* @param unicode The unicode value for the text entered.
*/
void text_input(const std::string& unicode);
/**
* Fires a keyboard event which has no parameters.
*
@ -418,7 +411,6 @@ void sdl_event_handler::handle_event(const SDL_Event& event)
break;
case SDL_TEXTINPUT:
text_input(event.text.text);
break;
case SDL_FINGERMOTION:
@ -705,11 +697,6 @@ void sdl_event_handler::key_down(const SDL_Event& event)
}
}
void sdl_event_handler::text_input(const std::string& unicode)
{
key_down(SDLK_UNKNOWN, static_cast<SDL_Keymod>(0), unicode);
}
bool sdl_event_handler::hotkey_pressed(const hotkey::hotkey_ptr key)
{
dispatcher* dispatcher = keyboard_dispatcher();