@@ -551,18 +551,18 @@ void InputEventConfigurationDialog::_input_list_item_selected() {
551551}
552552
553553void InputEventConfigurationDialog::_device_selection_changed (int p_option_button_index) {
554- // Option index 0 corresponds to "All Devices" (value of -3).
555- // Otherwise subtract 1 as option index 1 corresponds to device 0, etc...
556- event->set_device (p_option_button_index == 0 ? InputEvent::DEVICE_ID_ALL_DEVICES : p_option_button_index - 1 );
554+ // Subtract 1 as option index 0 corresponds to "All Devices" (value of -1)
555+ // and option index 1 corresponds to device 0, etc...
556+ event->set_device (p_option_button_index - 1 );
557557 event_as_text->set_text (EventListenerLineEdit::get_event_text (event, true ));
558558}
559559
560560void InputEventConfigurationDialog::_set_current_device (int p_device) {
561- device_id_option->select (p_device == InputEvent::DEVICE_ID_ALL_DEVICES ? 0 : p_device + 1 );
561+ device_id_option->select (p_device + 1 );
562562}
563563
564564int InputEventConfigurationDialog::_get_current_device () const {
565- return device_id_option->get_selected () == 0 ? InputEvent::DEVICE_ID_ALL_DEVICES : device_id_option-> get_selected () - 1 ;
565+ return device_id_option->get_selected () - 1 ;
566566}
567567
568568void InputEventConfigurationDialog::_notification (int p_what) {
@@ -705,12 +705,11 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() {
705705
706706 device_id_option = memnew (OptionButton);
707707 device_id_option->set_h_size_flags (Control::SIZE_EXPAND_FILL);
708- device_id_option->add_item (EventListenerLineEdit::get_device_string (InputEvent::DEVICE_ID_ALL_DEVICES));
709- for (int i = 0 ; i < 8 ; i++) {
708+ for (int i = -1 ; i < 8 ; i++) {
710709 device_id_option->add_item (EventListenerLineEdit::get_device_string (i));
711710 }
712711 device_id_option->connect (SceneStringName (item_selected), callable_mp (this , &InputEventConfigurationDialog::_device_selection_changed));
713- _set_current_device (InputEvent::DEVICE_ID_ALL_DEVICES );
712+ _set_current_device (InputMap::ALL_DEVICES );
714713 device_container->add_child (device_id_option);
715714
716715 device_container->hide ();
0 commit comments