diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index b88174453..2545cd545 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -918,6 +918,19 @@ void GuiMenu::openInputDeviceOptions() } }); + // Whether to ignore keyboard input (except the quit shortcut). + auto inputIgnoreKeyboard = std::make_shared(); + inputIgnoreKeyboard->setState(Settings::getInstance()->getBool("InputIgnoreKeyboard")); + s->addWithLabel("IGNORE KEYBOARD INPUT", inputIgnoreKeyboard); + s->addSaveFunc([inputIgnoreKeyboard, s] { + if (Settings::getInstance()->getBool("InputIgnoreKeyboard") != + inputIgnoreKeyboard->getState()) { + Settings::getInstance()->setBool("InputIgnoreKeyboard", + inputIgnoreKeyboard->getState()); + s->setNeedsSaving(); + } + }); + // Configure keyboard and controllers. ComponentListRow configureInputRow; configureInputRow.elements.clear(); diff --git a/es-core/src/InputManager.cpp b/es-core/src/InputManager.cpp index 6a79c3570..93a0933f4 100644 --- a/es-core/src/InputManager.cpp +++ b/es-core/src/InputManager.cpp @@ -450,11 +450,17 @@ bool InputManager::parseEvent(const SDL_Event& event) } } + if (Settings::getInstance()->getBool("InputIgnoreKeyboard")) + return true; + mWindow->input(getInputConfigByDevice(DEVICE_KEYBOARD), Input(DEVICE_KEYBOARD, TYPE_KEY, event.key.keysym.sym, 1, false)); return true; } case SDL_KEYUP: { + if (Settings::getInstance()->getBool("InputIgnoreKeyboard")) + return true; + mWindow->input(getInputConfigByDevice(DEVICE_KEYBOARD), Input(DEVICE_KEYBOARD, TYPE_KEY, event.key.keysym.sym, 0, false)); return true; diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index c30537574..fea763b68 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -202,6 +202,7 @@ void Settings::setDefaults() // Input device settings. mStringMap["InputControllerType"] = {"xbox", "xbox"}; mBoolMap["InputOnlyFirstController"] = {false, false}; + mBoolMap["InputIgnoreKeyboard"] = {false, false}; // Game collection settings. mStringMap["CollectionSystemsAuto"] = {"", ""};