[Input Map] Generate missing values instead of disabling options.

This commit is contained in:
bruvzg 2023-06-06 10:50:46 +03:00
parent e7d2e49688
commit c3cb846f72
No known key found for this signature in database
GPG key ID: 7960FCF39844EC38

View file

@ -107,6 +107,33 @@ void InputEventConfigurationDialog::_set_event(const Ref<InputEvent> &p_event, c
// Update mode selector based on original key event.
Ref<InputEventKey> ko = p_original_event;
if (ko.is_valid()) {
if (ko->get_keycode() == Key::NONE) {
if (ko->get_physical_keycode() != Key::NONE) {
ko->set_keycode(ko->get_physical_keycode());
}
if (ko->get_key_label() != Key::NONE) {
ko->set_keycode(fix_keycode((char32_t)ko->get_key_label(), Key::NONE));
}
}
if (ko->get_physical_keycode() == Key::NONE) {
if (ko->get_keycode() != Key::NONE) {
ko->set_physical_keycode(ko->get_keycode());
}
if (ko->get_key_label() != Key::NONE) {
ko->set_physical_keycode(fix_keycode((char32_t)ko->get_key_label(), Key::NONE));
}
}
if (ko->get_key_label() == Key::NONE) {
if (ko->get_keycode() != Key::NONE) {
ko->set_key_label(fix_key_label((char32_t)ko->get_keycode(), Key::NONE));
}
if (ko->get_physical_keycode() != Key::NONE) {
ko->set_key_label(fix_key_label((char32_t)ko->get_physical_keycode(), Key::NONE));
}
}
key_mode->set_item_disabled(KEYMODE_KEYCODE, ko->get_keycode() == Key::NONE);
key_mode->set_item_disabled(KEYMODE_PHY_KEYCODE, ko->get_physical_keycode() == Key::NONE);
key_mode->set_item_disabled(KEYMODE_UNICODE, ko->get_key_label() == Key::NONE);