1
0

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
This commit is contained in:
Deve 2023-03-17 14:15:26 +01:00 committed by GitHub
parent aae3837222
commit 2249e49f1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -353,7 +353,7 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
if (event.EventType == EET_KEY_INPUT_EVENT && active_key if (event.EventType == EET_KEY_INPUT_EVENT && active_key
&& event.KeyInput.PressedDown) { && event.KeyInput.PressedDown) {
bool prefer_character = shift_down; bool prefer_character = shift_down && event.KeyInput.Char != 0;
KeyPress kp(event.KeyInput, prefer_character); KeyPress kp(event.KeyInput, prefer_character);
if (event.KeyInput.Key == irr::KEY_DELETE) if (event.KeyInput.Key == irr::KEY_DELETE)
@ -412,6 +412,13 @@ bool GUIKeyChangeMenu::OnEvent(const SEvent& event)
&& event.KeyInput.Key == irr::KEY_ESCAPE) { && event.KeyInput.Key == irr::KEY_ESCAPE) {
quitMenu(); quitMenu();
return true; 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) { } else if (event.EventType == EET_GUI_EVENT) {
if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST if (event.GUIEvent.EventType == gui::EGET_ELEMENT_FOCUS_LOST
&& isVisible()) && isVisible())