Hotkey Bind: quick hack to allow dialog to function even without fix from 585ce88 (now reverted)

This commit is contained in:
Charles Dang 2017-03-16 01:34:34 +11:00
parent 5ae33e1f02
commit 3ad798f0a1

View File

@ -48,6 +48,14 @@ void hotkey_bind::pre_show(window& window)
void hotkey_bind::key_press_callback(window& window, const SDL_Keycode key)
{
/* HACK: SDL_KEYDOWN and SDL_TEXTINPUT events forward to the same GUI2 event (SDL_KEY_DOWN), meaning
* this even gets fired twice, causing problems since 'key' will be 0 in the latter case. SDLK_UNKNOWN
* is the key value used by SDL_TEXTINPUT handling, so exit here if that's detected.
*/
if(key == SDLK_UNKNOWN) {
return;
}
new_binding_ = hotkey::create_hotkey(hotkey_id_, SDL_GetScancodeFromKey(key));
window.set_retval(window::OK);