remove exit combo ESC, add combo Alt+Q

This commit is contained in:
SophiaHadash 2021-07-07 14:13:46 +02:00
parent 7a072674d3
commit 17d28ea88b
2 changed files with 10 additions and 22 deletions

View file

@ -1190,13 +1190,12 @@ void GuiMenu::openOtherOptions()
std::vector<std::string> exitButtonCombos; std::vector<std::string> exitButtonCombos;
exitButtonCombos.push_back("F4"); exitButtonCombos.push_back("F4");
exitButtonCombos.push_back("Alt + F4"); exitButtonCombos.push_back("Alt + F4");
exitButtonCombos.push_back("Escape"); #if defined(_WIN64) || defined(__unix__)
exitButtonCombos.push_back("Alt + Q");
#endif
#if defined(__APPLE__) #if defined(__APPLE__)
exitButtonCombos.push_back("\u2318 + Q"); exitButtonCombos.push_back("\u2318 + Q");
#endif #endif
#if defined(_WIN64)
exitButtonCombos.push_back("Ctrl + F4");
#endif
for (auto it = exitButtonCombos.cbegin(); it != exitButtonCombos.cend(); it++) { for (auto it = exitButtonCombos.cbegin(); it != exitButtonCombos.cend(); it++) {
exit_button_config->add(*it, *it, Settings::getInstance()-> exit_button_config->add(*it, *it, Settings::getInstance()->
getString("ExitButtonCombo") == *it); getString("ExitButtonCombo") == *it);

View file

@ -30,7 +30,6 @@ int SDL_USER_CECBUTTONUP = -1;
// save button states for combo-button exit support and predefine exit option-function map // save button states for combo-button exit support and predefine exit option-function map
static bool altDown = false; static bool altDown = false;
static bool ctrlDown = false;
static bool lguiDown = false; static bool lguiDown = false;
InputManager* InputManager::sInstance = nullptr; InputManager* InputManager::sInstance = nullptr;
@ -442,10 +441,6 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window)
{ {
altDown = true; altDown = true;
} }
if (event.key.keysym.sym == SDLK_LCTRL)
{
ctrlDown = true;
}
if (event.key.keysym.sym == SDLK_LGUI) if (event.key.keysym.sym == SDLK_LGUI)
{ {
lguiDown = true; lguiDown = true;
@ -458,18 +453,16 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window)
return false; return false;
// handle application exit // handle application exit
bool exitState = false; bool exitState;
std::string exitOption = Settings::getInstance()->getString("ExitButtonCombo"); std::string exitOption = Settings::getInstance()->getString("ExitButtonCombo");
if (exitOption == "F4"){ if (exitOption == "Alt + F4"){
exitState = event.key.keysym.sym == SDLK_F4;
}else if (exitOption == "Alt + F4"){
exitState = event.key.keysym.sym == SDLK_F4 && altDown; exitState = event.key.keysym.sym == SDLK_F4 && altDown;
}else if (exitOption == "\u2318 + Q"){ }else if (exitOption == "\u2318 + Q"){
exitState = event.key.keysym.sym == SDLK_F4 && lguiDown; exitState = event.key.keysym.sym == SDLK_q && lguiDown;
}else if (exitOption == "Ctrl + F4"){ }else if (exitOption == "Alt + Q"){
exitState = event.key.keysym.sym == SDLK_F4 && ctrlDown; exitState = event.key.keysym.sym == SDLK_q && altDown;
}else if (exitOption == "Escape"){ }else{
exitState = event.key.keysym.sym == SDLK_ESCAPE; exitState = event.key.keysym.sym == SDLK_F4;
} }
if (exitState) { if (exitState) {
SDL_Event quit; SDL_Event quit;
@ -489,10 +482,6 @@ bool InputManager::parseEvent(const SDL_Event& event, Window* window)
{ {
altDown = false; altDown = false;
} }
if (event.key.keysym.sym == SDLK_LCTRL)
{
ctrlDown = false;
}
if (event.key.keysym.sym == SDLK_LGUI) if (event.key.keysym.sym == SDLK_LGUI)
{ {
lguiDown = false; lguiDown = false;