diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-06 23:51:26 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-06 23:51:26 +0100 |
commit | cd0f1e9b102fe899d37921c1155df08966549363 (patch) | |
tree | ce35d1c6f721a69f35d8fb6b1655c0fa288ed64e /scene/main | |
parent | 6a58f4e305bc013199a2a7631775fb084d3c1510 (diff) | |
parent | 8748f4dcaa9a7f703529e48c22064948d5121fd3 (diff) |
Merge pull request #72740 from Sauermann/fix-event-device-id
Fix mouse/drag/touch InputEvents having no device id
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 5 | ||||
-rw-r--r-- | scene/main/window.cpp | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index b06ede1be8..cbb34a480b 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -614,7 +614,7 @@ void Viewport::_process_picking() { physics_last_mouse_state.mouse_mask.clear_flag(mouse_button_to_mask(mb->get_button_index())); // If touch mouse raised, assume we don't know last mouse pos until new events come - if (mb->get_device() == InputEvent::DEVICE_ID_TOUCH_MOUSE) { + if (mb->get_device() == InputEvent::DEVICE_ID_EMULATION) { physics_has_last_mousepos = false; } } @@ -2290,6 +2290,7 @@ void Viewport::_drop_mouse_focus() { mb->set_global_position(c->get_local_mouse_position()); mb->set_button_index(MouseButton(i + 1)); mb->set_pressed(false); + mb->set_device(InputEvent::DEVICE_ID_INTERNAL); c->_call_gui_input(mb); } } @@ -2401,6 +2402,7 @@ void Viewport::_post_gui_grab_click_focus() { mb->set_position(click); mb->set_button_index(MouseButton(i + 1)); mb->set_pressed(false); + mb->set_device(InputEvent::DEVICE_ID_INTERNAL); gui.mouse_focus->_call_gui_input(mb); } } @@ -2418,6 +2420,7 @@ void Viewport::_post_gui_grab_click_focus() { mb->set_position(click); mb->set_button_index(MouseButton(i + 1)); mb->set_pressed(true); + mb->set_device(InputEvent::DEVICE_ID_INTERNAL); MessageQueue::get_singleton()->push_callable(callable_mp(gui.mouse_focus, &Control::_call_gui_input), mb); } } diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 33946246b0..9fcfb29ef7 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -647,6 +647,7 @@ void Window::update_mouse_cursor_shape() { mm.instantiate(); mm->set_position(pos); mm->set_global_position(xform.xform(pos)); + mm->set_device(InputEvent::DEVICE_ID_INTERNAL); push_input(mm); } |