浏览代码

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
Vadim Markovtsev 9 年之前
父节点
当前提交
32ece9513d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      client/windows/CAdvmapInterface.cpp

+ 1 - 1
client/windows/CAdvmapInterface.cpp

@@ -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: