From 17d28ea88b098293073f722491c50538f179480b Mon Sep 17 00:00:00 2001 From: SophiaHadash <=> Date: Wed, 7 Jul 2021 14:13:46 +0200 Subject: [PATCH] remove exit combo ESC, add combo Alt+Q --- es-app/src/guis/GuiMenu.cpp | 7 +++---- es-core/src/InputManager.cpp | 25 +++++++------------------ 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index ca478c2da..f2a7d93d0 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -1190,13 +1190,12 @@ void GuiMenu::openOtherOptions() std::vector<std::string> exitButtonCombos; exitButtonCombos.push_back("F4"); exitButtonCombos.push_back("Alt + F4"); - exitButtonCombos.push_back("Escape"); + #if defined(_WIN64) || defined(__unix__) + exitButtonCombos.push_back("Alt + Q"); + #endif #if defined(__APPLE__) exitButtonCombos.push_back("\u2318 + Q"); #endif - #if defined(_WIN64) - exitButtonCombos.push_back("Ctrl + F4"); - #endif for (auto it = exitButtonCombos.cbegin(); it != exitButtonCombos.cend(); it++) { exit_button_config->add(*it, *it, Settings::getInstance()-> getString("ExitButtonCombo") == *it); diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 3cbe01d76..53c28cea8 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -30,7 +30,6 @@ int SDL_USER_CECBUTTONUP = -1; // save button states for combo-button exit support and predefine exit option-function map static bool altDown = false; -static bool ctrlDown = false; static bool lguiDown = false; InputManager* InputManager::sInstance = nullptr; @@ -442,10 +441,6 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window) { altDown = true; } - if (event.key.keysym.sym == SDLK_LCTRL) - { - ctrlDown = true; - } if (event.key.keysym.sym == SDLK_LGUI) { lguiDown = true; @@ -458,18 +453,16 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window) return false; // handle application exit - bool exitState = false; + bool exitState; std::string exitOption = Settings::getInstance()->getString("ExitButtonCombo"); - if (exitOption == "F4"){ - exitState = event.key.keysym.sym == SDLK_F4; - }else if (exitOption == "Alt + F4"){ + if (exitOption == "Alt + F4"){ exitState = event.key.keysym.sym == SDLK_F4 && altDown; }else if (exitOption == "\u2318 + Q"){ - exitState = event.key.keysym.sym == SDLK_F4 && lguiDown; - }else if (exitOption == "Ctrl + F4"){ - exitState = event.key.keysym.sym == SDLK_F4 && ctrlDown; - }else if (exitOption == "Escape"){ - exitState = event.key.keysym.sym == SDLK_ESCAPE; + exitState = event.key.keysym.sym == SDLK_q && lguiDown; + }else if (exitOption == "Alt + Q"){ + exitState = event.key.keysym.sym == SDLK_q && altDown; + }else{ + exitState = event.key.keysym.sym == SDLK_F4; } if (exitState) { SDL_Event quit; @@ -489,10 +482,6 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window) { altDown = false; } - if (event.key.keysym.sym == SDLK_LCTRL) - { - ctrlDown = false; - } if (event.key.keysym.sym == SDLK_LGUI) { lguiDown = false;