1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-11 13:10:58 +00:00

Fix fake null-motion mouse event flood

This commit also improves a bit the code quality by making the intent of fake events (and themselves) more explicit.

Fixes #26460.
This commit is contained in:
Pedro J. Estébanez
2019-03-09 22:03:27 +01:00
parent 86d6a72c97
commit f757460ec8
5 changed files with 28 additions and 17 deletions

View File

@@ -355,7 +355,7 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
Ref<InputEventMouseButton> button_event;
button_event.instance();
button_event->set_device(-1);
button_event->set_device(InputEvent::DEVICE_ID_TOUCH_MOUSE);
button_event->set_position(st->get_position());
button_event->set_global_position(st->get_position());
button_event->set_pressed(st->is_pressed());
@@ -384,7 +384,7 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
Ref<InputEventMouseMotion> motion_event;
motion_event.instance();
motion_event->set_device(-1);
motion_event->set_device(InputEvent::DEVICE_ID_TOUCH_MOUSE);
motion_event->set_position(sd->get_position());
motion_event->set_global_position(sd->get_position());
motion_event->set_relative(sd->get_relative());
@@ -602,7 +602,7 @@ void InputDefault::ensure_touch_mouse_raised() {
Ref<InputEventMouseButton> button_event;
button_event.instance();
button_event->set_device(-1);
button_event->set_device(InputEvent::DEVICE_ID_TOUCH_MOUSE);
button_event->set_position(mouse_pos);
button_event->set_global_position(mouse_pos);
button_event->set_pressed(false);