summaryrefslogtreecommitdiffstats
path: root/editor/input_event_configuration_dialog.cpp
diff options
context:
space:
mode:
authorSpartan322 <Megacake1234@gmail.com>2024-11-20 16:20:16 -0500
committerSpartan322 <Megacake1234@gmail.com>2024-11-20 18:02:42 -0500
commit9857e4762b8d076259c4be863ba9f53df306d940 (patch)
treeb03c5b5de96e29ffb7e1b008912d21aba5629bc5 /editor/input_event_configuration_dialog.cpp
parentfd9045fe09e9bea691f0169c16d45cbebddb6bba (diff)
parent9e6098432aac35bae42c9089a29ba2a80320d823 (diff)
downloadredot-engine-9857e4762b8d076259c4be863ba9f53df306d940.tar.gz
Merge commit godotengine/godot@9e6098432aac35bae42c9089a29ba2a80320d823
Diffstat (limited to 'editor/input_event_configuration_dialog.cpp')
-rw-r--r--editor/input_event_configuration_dialog.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp
index 9c36e2be54..c98f288f06 100644
--- a/editor/input_event_configuration_dialog.cpp
+++ b/editor/input_event_configuration_dialog.cpp
@@ -553,18 +553,18 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
}
void InputEventConfigurationDialog::_device_selection_changed(int p_option_button_index) {
- // Option index 0 corresponds to "All Devices" (value of -3).
- // Otherwise subtract 1 as option index 1 corresponds to device 0, etc...
- event->set_device(p_option_button_index == 0 ? InputEvent::DEVICE_ID_ALL_DEVICES : p_option_button_index - 1);
+ // Subtract 1 as option index 0 corresponds to "All Devices" (value of -1)
+ // and option index 1 corresponds to device 0, etc...
+ event->set_device(p_option_button_index - 1);
event_as_text->set_text(EventListenerLineEdit::get_event_text(event, true));
}
void InputEventConfigurationDialog::_set_current_device(int p_device) {
- device_id_option->select(p_device == InputEvent::DEVICE_ID_ALL_DEVICES ? 0 : p_device + 1);
+ device_id_option->select(p_device + 1);
}
int InputEventConfigurationDialog::_get_current_device() const {
- return device_id_option->get_selected() == 0 ? InputEvent::DEVICE_ID_ALL_DEVICES : device_id_option->get_selected() - 1;
+ return device_id_option->get_selected() - 1;
}
void InputEventConfigurationDialog::_notification(int p_what) {
@@ -707,12 +707,11 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
device_id_option = memnew(OptionButton);
device_id_option->set_h_size_flags(Control::SIZE_EXPAND_FILL);
- device_id_option->add_item(EventListenerLineEdit::get_device_string(InputEvent::DEVICE_ID_ALL_DEVICES));
- for (int i = 0; i < 8; i++) {
+ for (int i = -1; i < 8; i++) {
device_id_option->add_item(EventListenerLineEdit::get_device_string(i));
}
device_id_option->connect(SceneStringName(item_selected), callable_mp(this, &InputEventConfigurationDialog::_device_selection_changed));
- _set_current_device(InputEvent::DEVICE_ID_ALL_DEVICES);
+ _set_current_device(InputMap::ALL_DEVICES);
device_container->add_child(device_id_option);
device_container->hide();