From 5e88542be6265998d72072f9419bd8c7c9ab6e6e Mon Sep 17 00:00:00 2001 From: Deve Date: Fri, 17 Mar 2023 14:15:26 +0100 Subject: [PATCH] Fix left shift key in the change menu (#128) * Set shift_down false when it's not pressed anymore * Prefer character only if Char is not 0 which does not happen in SDL anyway --- src/gui/guiKeyChangeMenu.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gui/guiKeyChangeMenu.cpp b/src/gui/guiKeyChangeMenu.cpp index e603b12ad..736a2bebd 100644 --- a/src/gui/guiKeyChangeMenu.cpp +++ b/src/gui/guiKeyChangeMenu.cpp @@ -353,7 +353,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event) if (event.EventType == EET_KEY_INPUT_EVENT && active_key && event.KeyInput.PressedDown) { - bool prefer_character = shift_down; + bool prefer_character = shift_down && event.KeyInput.Char != 0; KeyPress kp(event.KeyInput, prefer_character); if (event.KeyInput.Key == irr::KEY_DELETE) @@ -412,6 +412,13 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event) && event.KeyInput.Key == irr::KEY_ESCAPE) { quitMenu(); return true; + } else if (event.EventType == EET_KEY_INPUT_EVENT && + !event.KeyInput.PressedDown) { + if (shift_down && !event.KeyInput.Shift) { + shift_down = false; + active_key = nullptr; + return true; + } } else if (event.EventType == EET_GUI_EVENT) { if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST && isVisible())