mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added an 'Ignore keyboard input' option to the input device settings menu.
This commit is contained in:
parent
db46180024
commit
da343c49aa
|
@ -918,6 +918,19 @@ void GuiMenu::openInputDeviceOptions()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Whether to ignore keyboard input (except the quit shortcut).
|
||||||
|
auto inputIgnoreKeyboard = std::make_shared<SwitchComponent>();
|
||||||
|
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.
|
// Configure keyboard and controllers.
|
||||||
ComponentListRow configureInputRow;
|
ComponentListRow configureInputRow;
|
||||||
configureInputRow.elements.clear();
|
configureInputRow.elements.clear();
|
||||||
|
|
|
@ -450,11 +450,17 @@ bool InputManager::parseEvent(const SDL_Event& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Settings::getInstance()->getBool("InputIgnoreKeyboard"))
|
||||||
|
return true;
|
||||||
|
|
||||||
mWindow->input(getInputConfigByDevice(DEVICE_KEYBOARD),
|
mWindow->input(getInputConfigByDevice(DEVICE_KEYBOARD),
|
||||||
Input(DEVICE_KEYBOARD, TYPE_KEY, event.key.keysym.sym, 1, false));
|
Input(DEVICE_KEYBOARD, TYPE_KEY, event.key.keysym.sym, 1, false));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case SDL_KEYUP: {
|
case SDL_KEYUP: {
|
||||||
|
if (Settings::getInstance()->getBool("InputIgnoreKeyboard"))
|
||||||
|
return true;
|
||||||
|
|
||||||
mWindow->input(getInputConfigByDevice(DEVICE_KEYBOARD),
|
mWindow->input(getInputConfigByDevice(DEVICE_KEYBOARD),
|
||||||
Input(DEVICE_KEYBOARD, TYPE_KEY, event.key.keysym.sym, 0, false));
|
Input(DEVICE_KEYBOARD, TYPE_KEY, event.key.keysym.sym, 0, false));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -202,6 +202,7 @@ void Settings::setDefaults()
|
||||||
// Input device settings.
|
// Input device settings.
|
||||||
mStringMap["InputControllerType"] = {"xbox", "xbox"};
|
mStringMap["InputControllerType"] = {"xbox", "xbox"};
|
||||||
mBoolMap["InputOnlyFirstController"] = {false, false};
|
mBoolMap["InputOnlyFirstController"] = {false, false};
|
||||||
|
mBoolMap["InputIgnoreKeyboard"] = {false, false};
|
||||||
|
|
||||||
// Game collection settings.
|
// Game collection settings.
|
||||||
mStringMap["CollectionSystemsAuto"] = {"", ""};
|
mStringMap["CollectionSystemsAuto"] = {"", ""};
|
||||||
|
|
Loading…
Reference in a new issue