Merge pull request #56755 from madmiraal/fix-45592-3.x
This commit is contained in:
commit
ed869729ae
5 changed files with 8 additions and 14 deletions
|
@ -355,18 +355,20 @@ void InputDefault::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool
|
|||
Ref<InputEventMouseMotion> mm = p_event;
|
||||
|
||||
if (mm.is_valid()) {
|
||||
Point2 pos = mm->get_global_position();
|
||||
if (mouse_pos != pos) {
|
||||
set_mouse_position(pos);
|
||||
Point2 position = mm->get_global_position();
|
||||
if (mouse_pos != position) {
|
||||
set_mouse_position(position);
|
||||
}
|
||||
Vector2 relative = mm->get_relative();
|
||||
mouse_speed_track.update(relative);
|
||||
|
||||
if (main_loop && emulate_touch_from_mouse && !p_is_emulated && mm->get_button_mask() & 1) {
|
||||
Ref<InputEventScreenDrag> drag_event;
|
||||
drag_event.instance();
|
||||
|
||||
drag_event->set_position(mm->get_position());
|
||||
drag_event->set_relative(mm->get_relative());
|
||||
drag_event->set_speed(mm->get_speed());
|
||||
drag_event->set_position(position);
|
||||
drag_event->set_relative(relative);
|
||||
drag_event->set_speed(get_last_mouse_speed());
|
||||
|
||||
main_loop->input_event(drag_event);
|
||||
}
|
||||
|
@ -552,7 +554,6 @@ void InputDefault::set_main_loop(MainLoop *p_main_loop) {
|
|||
}
|
||||
|
||||
void InputDefault::set_mouse_position(const Point2 &p_posf) {
|
||||
mouse_speed_track.update(p_posf - mouse_pos);
|
||||
mouse_pos = p_posf;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,6 @@ void OS_JavaScript::mouse_move_callback(double p_x, double p_y, double p_rel_x,
|
|||
ev->set_global_position(ev->get_position());
|
||||
|
||||
ev->set_relative(Vector2(p_rel_x, p_rel_y));
|
||||
os->input->set_mouse_position(ev->get_position());
|
||||
ev->set_speed(os->input->get_last_mouse_speed());
|
||||
|
||||
os->input->parse_input_event(ev);
|
||||
|
|
|
@ -806,7 +806,6 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
|
|||
mm->set_relative(relativeMotion);
|
||||
get_key_modifier_state([event modifierFlags], mm);
|
||||
|
||||
OS_OSX::singleton->input->set_mouse_position(Point2(mouse_x, mouse_y));
|
||||
OS_OSX::singleton->push_input(mm);
|
||||
}
|
||||
|
||||
|
|
|
@ -397,7 +397,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
|
||||
mm->set_position(c);
|
||||
mm->set_global_position(c);
|
||||
input->set_mouse_position(c);
|
||||
mm->set_speed(Vector2(0, 0));
|
||||
|
||||
if (raw->data.mouse.usFlags == MOUSE_MOVE_RELATIVE) {
|
||||
|
@ -504,7 +503,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
SetCursorPos(pos.x, pos.y);
|
||||
}
|
||||
|
||||
input->set_mouse_position(mm->get_position());
|
||||
mm->set_speed(input->get_last_mouse_speed());
|
||||
|
||||
if (old_invalid) {
|
||||
|
@ -648,7 +646,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
SetCursorPos(pos.x, pos.y);
|
||||
}
|
||||
|
||||
input->set_mouse_position(mm->get_position());
|
||||
mm->set_speed(input->get_last_mouse_speed());
|
||||
|
||||
if (old_invalid) {
|
||||
|
@ -750,7 +747,6 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
SetCursorPos(pos.x, pos.y);
|
||||
}
|
||||
|
||||
input->set_mouse_position(mm->get_position());
|
||||
mm->set_speed(input->get_last_mouse_speed());
|
||||
|
||||
if (old_invalid) {
|
||||
|
|
|
@ -2828,7 +2828,6 @@ void OS_X11::process_xevents() {
|
|||
mm->set_button_mask(get_mouse_button_state());
|
||||
mm->set_position(posi);
|
||||
mm->set_global_position(posi);
|
||||
input->set_mouse_position(posi);
|
||||
mm->set_speed(input->get_last_mouse_speed());
|
||||
|
||||
mm->set_relative(rel);
|
||||
|
|
Loading…
Reference in a new issue