1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Fix 2331 save menu keyboard event leak

The control flows the following way:
- we receive SDL_KEYDOWN with letter 's' in the adventure map interface
- save dialog opens
- text input receives focus
- text input enables receiving SDL_KeyboardEvent-s which go between DOWN and UP
- the button on keyboard becomes UP (the menu opens very fast)
- text input receives SDL_KeyboardEvent and inserts 's'
- text input receives SDL_KEYUP

So the apparent fix is to open the save dialog on SDL_KEYUP event
This commit is contained in:
Vadim Markovtsev
2016-01-28 10:26:40 +03:00
parent b7fbbfdebe
commit 32ece9513d

View File

@ -1069,7 +1069,7 @@ void CAdvMapInt::keyPressed(const SDL_KeyboardEvent & key)
LOCPLINT->proposeLoadingGame();
return;
case SDLK_s:
if(isActive())
if(isActive() && key.type == SDL_KEYUP)
GH.pushInt(new CSavingScreen(CPlayerInterface::howManyPeople > 1));
return;
case SDLK_d: