Преглед на файлове

Improve input event accumulation

- API has been simplified: all events now go through `parse_input_event()`. Whether they are accumulated or not depends on the `use_accumulated_input` flag.
- Event accumulation is now thread-safe (it was not needed so far, but it prepares the ground for the following changes).
- Touch drag events now support accumulation.
Pedro J. Estébanez преди 4 години
родител
ревизия
7c864d41c9

+ 7 - 9
core/input/input.cpp

@@ -460,10 +460,6 @@ Vector3 Input::get_gyroscope() const {
 	return gyroscope;
 	return gyroscope;
 }
 }
 
 
-void Input::parse_input_event(const Ref<InputEvent> &p_event) {
-	_parse_input_event_impl(p_event, false);
-}
-
 void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) {
 void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_emulated) {
 	// Notes on mouse-touch emulation:
 	// Notes on mouse-touch emulation:
 	// - Emulated mouse events are parsed, that is, re-routed to this method, so they make the same effects
 	// - Emulated mouse events are parsed, that is, re-routed to this method, so they make the same effects
@@ -472,8 +468,6 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
 	// - Emulated touch events are handed right to the main loop (i.e., the SceneTree) because they don't
 	// - Emulated touch events are handed right to the main loop (i.e., the SceneTree) because they don't
 	//   require additional handling by this class.
 	//   require additional handling by this class.
 
 
-	_THREAD_SAFE_METHOD_
-
 	Ref<InputEventKey> k = p_event;
 	Ref<InputEventKey> k = p_event;
 	if (k.is_valid() && !k->is_echo() && k->get_keycode() != 0) {
 	if (k.is_valid() && !k->is_echo() && k->get_keycode() != 0) {
 		if (k->is_pressed()) {
 		if (k->is_pressed()) {
@@ -838,11 +832,13 @@ void Input::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, co
 	set_custom_mouse_cursor_func(p_cursor, p_shape, p_hotspot);
 	set_custom_mouse_cursor_func(p_cursor, p_shape, p_hotspot);
 }
 }
 
 
-void Input::accumulate_input_event(const Ref<InputEvent> &p_event) {
+void Input::parse_input_event(const Ref<InputEvent> &p_event) {
+	_THREAD_SAFE_METHOD_
+
 	ERR_FAIL_COND(p_event.is_null());
 	ERR_FAIL_COND(p_event.is_null());
 
 
 	if (!use_accumulated_input) {
 	if (!use_accumulated_input) {
-		parse_input_event(p_event);
+		_parse_input_event_impl(p_event, false);
 		return;
 		return;
 	}
 	}
 	if (!accumulated_events.is_empty() && accumulated_events.back()->get()->accumulate(p_event)) {
 	if (!accumulated_events.is_empty() && accumulated_events.back()->get()->accumulate(p_event)) {
@@ -853,8 +849,10 @@ void Input::accumulate_input_event(const Ref<InputEvent> &p_event) {
 }
 }
 
 
 void Input::flush_accumulated_events() {
 void Input::flush_accumulated_events() {
+	_THREAD_SAFE_METHOD_
+
 	while (accumulated_events.front()) {
 	while (accumulated_events.front()) {
-		parse_input_event(accumulated_events.front()->get());
+		_parse_input_event_impl(accumulated_events.front()->get(), false);
 		accumulated_events.pop_front();
 		accumulated_events.pop_front();
 	}
 	}
 }
 }

+ 0 - 1
core/input/input.h

@@ -323,7 +323,6 @@ public:
 	String get_joy_guid(int p_device) const;
 	String get_joy_guid(int p_device) const;
 	void set_fallback_mapping(String p_guid);
 	void set_fallback_mapping(String p_guid);
 
 
-	void accumulate_input_event(const Ref<InputEvent> &p_event);
 	void flush_accumulated_events();
 	void flush_accumulated_events();
 	void set_use_accumulated_input(bool p_enable);
 	void set_use_accumulated_input(bool p_enable);
 
 

+ 16 - 0
core/input/input_event.cpp

@@ -1210,6 +1210,22 @@ String InputEventScreenDrag::to_string() {
 	return vformat("InputEventScreenDrag: index=%d, position=(%s), relative=(%s), speed=(%s)", index, String(get_position()), String(get_relative()), String(get_speed()));
 	return vformat("InputEventScreenDrag: index=%d, position=(%s), relative=(%s), speed=(%s)", index, String(get_position()), String(get_relative()), String(get_speed()));
 }
 }
 
 
+bool InputEventScreenDrag::accumulate(const Ref<InputEvent> &p_event) {
+	Ref<InputEventScreenDrag> drag = p_event;
+	if (drag.is_null())
+		return false;
+
+	if (get_index() != drag->get_index()) {
+		return false;
+	}
+
+	set_position(drag->get_position());
+	set_speed(drag->get_speed());
+	relative += drag->get_relative();
+
+	return true;
+}
+
 void InputEventScreenDrag::_bind_methods() {
 void InputEventScreenDrag::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_index", "index"), &InputEventScreenDrag::set_index);
 	ClassDB::bind_method(D_METHOD("set_index", "index"), &InputEventScreenDrag::set_index);
 	ClassDB::bind_method(D_METHOD("get_index"), &InputEventScreenDrag::get_index);
 	ClassDB::bind_method(D_METHOD("get_index"), &InputEventScreenDrag::get_index);

+ 2 - 0
core/input/input_event.h

@@ -410,6 +410,8 @@ public:
 	virtual String as_text() const override;
 	virtual String as_text() const override;
 	virtual String to_string() override;
 	virtual String to_string() override;
 
 
+	virtual bool accumulate(const Ref<InputEvent> &p_event) override;
+
 	InputEventScreenDrag() {}
 	InputEventScreenDrag() {}
 };
 };
 
 

+ 14 - 14
platform/android/display_server_android.cpp

@@ -557,7 +557,7 @@ void DisplayServerAndroid::process_key_event(int p_keycode, int p_scancode, int
 		OS_Android::get_singleton()->main_loop_request_go_back();
 		OS_Android::get_singleton()->main_loop_request_go_back();
 	}
 	}
 
 
-	Input::get_singleton()->accumulate_input_event(ev);
+	Input::get_singleton()->parse_input_event(ev);
 }
 }
 
 
 void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vector<DisplayServerAndroid::TouchPos> &p_points) {
 void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vector<DisplayServerAndroid::TouchPos> &p_points) {
@@ -571,7 +571,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto
 					ev->set_index(touch[i].id);
 					ev->set_index(touch[i].id);
 					ev->set_pressed(false);
 					ev->set_pressed(false);
 					ev->set_position(touch[i].pos);
 					ev->set_position(touch[i].pos);
-					Input::get_singleton()->accumulate_input_event(ev);
+					Input::get_singleton()->parse_input_event(ev);
 				}
 				}
 			}
 			}
 
 
@@ -588,7 +588,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto
 				ev->set_index(touch[i].id);
 				ev->set_index(touch[i].id);
 				ev->set_pressed(true);
 				ev->set_pressed(true);
 				ev->set_position(touch[i].pos);
 				ev->set_position(touch[i].pos);
-				Input::get_singleton()->accumulate_input_event(ev);
+				Input::get_singleton()->parse_input_event(ev);
 			}
 			}
 
 
 		} break;
 		} break;
@@ -614,7 +614,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto
 				ev->set_index(touch[i].id);
 				ev->set_index(touch[i].id);
 				ev->set_position(p_points[idx].pos);
 				ev->set_position(p_points[idx].pos);
 				ev->set_relative(p_points[idx].pos - touch[i].pos);
 				ev->set_relative(p_points[idx].pos - touch[i].pos);
-				Input::get_singleton()->accumulate_input_event(ev);
+				Input::get_singleton()->parse_input_event(ev);
 				touch.write[i].pos = p_points[idx].pos;
 				touch.write[i].pos = p_points[idx].pos;
 			}
 			}
 
 
@@ -629,7 +629,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto
 					ev->set_index(touch[i].id);
 					ev->set_index(touch[i].id);
 					ev->set_pressed(false);
 					ev->set_pressed(false);
 					ev->set_position(touch[i].pos);
 					ev->set_position(touch[i].pos);
-					Input::get_singleton()->accumulate_input_event(ev);
+					Input::get_singleton()->parse_input_event(ev);
 				}
 				}
 				touch.clear();
 				touch.clear();
 			}
 			}
@@ -646,7 +646,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto
 					ev->set_index(tp.id);
 					ev->set_index(tp.id);
 					ev->set_pressed(true);
 					ev->set_pressed(true);
 					ev->set_position(tp.pos);
 					ev->set_position(tp.pos);
-					Input::get_singleton()->accumulate_input_event(ev);
+					Input::get_singleton()->parse_input_event(ev);
 
 
 					break;
 					break;
 				}
 				}
@@ -660,7 +660,7 @@ void DisplayServerAndroid::process_touch(int p_event, int p_pointer, const Vecto
 					ev->set_index(touch[i].id);
 					ev->set_index(touch[i].id);
 					ev->set_pressed(false);
 					ev->set_pressed(false);
 					ev->set_position(touch[i].pos);
 					ev->set_position(touch[i].pos);
-					Input::get_singleton()->accumulate_input_event(ev);
+					Input::get_singleton()->parse_input_event(ev);
 					touch.remove(i);
 					touch.remove(i);
 
 
 					break;
 					break;
@@ -682,7 +682,7 @@ void DisplayServerAndroid::process_hover(int p_type, Point2 p_pos) {
 			ev->set_position(p_pos);
 			ev->set_position(p_pos);
 			ev->set_global_position(p_pos);
 			ev->set_global_position(p_pos);
 			ev->set_relative(p_pos - hover_prev_pos);
 			ev->set_relative(p_pos - hover_prev_pos);
-			Input::get_singleton()->accumulate_input_event(ev);
+			Input::get_singleton()->parse_input_event(ev);
 			hover_prev_pos = p_pos;
 			hover_prev_pos = p_pos;
 		} break;
 		} break;
 	}
 	}
@@ -710,7 +710,7 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio
 
 
 			ev->set_button_index(_button_index_from_mask(changed_button_mask));
 			ev->set_button_index(_button_index_from_mask(changed_button_mask));
 			ev->set_button_mask(event_buttons_mask);
 			ev->set_button_mask(event_buttons_mask);
-			Input::get_singleton()->accumulate_input_event(ev);
+			Input::get_singleton()->parse_input_event(ev);
 		} break;
 		} break;
 
 
 		case AMOTION_EVENT_ACTION_MOVE: {
 		case AMOTION_EVENT_ACTION_MOVE: {
@@ -728,7 +728,7 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio
 				ev->set_relative(event_pos);
 				ev->set_relative(event_pos);
 			}
 			}
 			ev->set_button_mask(event_buttons_mask);
 			ev->set_button_mask(event_buttons_mask);
-			Input::get_singleton()->accumulate_input_event(ev);
+			Input::get_singleton()->parse_input_event(ev);
 		} break;
 		} break;
 		case AMOTION_EVENT_ACTION_SCROLL: {
 		case AMOTION_EVENT_ACTION_SCROLL: {
 			Ref<InputEventMouseButton> ev;
 			Ref<InputEventMouseButton> ev;
@@ -763,11 +763,11 @@ void DisplayServerAndroid::_wheel_button_click(MouseButton event_buttons_mask, c
 	evd->set_button_index(wheel_button);
 	evd->set_button_index(wheel_button);
 	evd->set_button_mask(MouseButton(event_buttons_mask ^ (1 << (wheel_button - 1))));
 	evd->set_button_mask(MouseButton(event_buttons_mask ^ (1 << (wheel_button - 1))));
 	evd->set_factor(factor);
 	evd->set_factor(factor);
-	Input::get_singleton()->accumulate_input_event(evd);
+	Input::get_singleton()->parse_input_event(evd);
 	Ref<InputEventMouseButton> evdd = evd->duplicate();
 	Ref<InputEventMouseButton> evdd = evd->duplicate();
 	evdd->set_pressed(false);
 	evdd->set_pressed(false);
 	evdd->set_button_mask(event_buttons_mask);
 	evdd->set_button_mask(event_buttons_mask);
-	Input::get_singleton()->accumulate_input_event(evdd);
+	Input::get_singleton()->parse_input_event(evdd);
 }
 }
 
 
 void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Point2 p_pos) {
 void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Point2 p_pos) {
@@ -781,7 +781,7 @@ void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Poi
 	ev->set_button_index(_button_index_from_mask(event_button_mask));
 	ev->set_button_index(_button_index_from_mask(event_button_mask));
 	ev->set_button_mask(event_button_mask);
 	ev->set_button_mask(event_button_mask);
 	ev->set_double_click(true);
 	ev->set_double_click(true);
-	Input::get_singleton()->accumulate_input_event(ev);
+	Input::get_singleton()->parse_input_event(ev);
 }
 }
 
 
 MouseButton DisplayServerAndroid::_button_index_from_mask(MouseButton button_mask) {
 MouseButton DisplayServerAndroid::_button_index_from_mask(MouseButton button_mask) {
@@ -807,7 +807,7 @@ void DisplayServerAndroid::process_scroll(Point2 p_pos) {
 	_set_key_modifier_state(ev);
 	_set_key_modifier_state(ev);
 	ev->set_position(p_pos);
 	ev->set_position(p_pos);
 	ev->set_delta(p_pos - scroll_prev_pos);
 	ev->set_delta(p_pos - scroll_prev_pos);
-	Input::get_singleton()->accumulate_input_event(ev);
+	Input::get_singleton()->parse_input_event(ev);
 	scroll_prev_pos = p_pos;
 	scroll_prev_pos = p_pos;
 }
 }
 
 

+ 10 - 10
platform/linuxbsd/display_server_x11.cpp

@@ -2247,7 +2247,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
 					k->set_shift_pressed(true);
 					k->set_shift_pressed(true);
 				}
 				}
 
 
-				Input::get_singleton()->accumulate_input_event(k);
+				Input::get_singleton()->parse_input_event(k);
 			}
 			}
 			memfree(utf8string);
 			memfree(utf8string);
 			return;
 			return;
@@ -2396,7 +2396,7 @@ void DisplayServerX11::_handle_key_event(WindowID p_window, XKeyEvent *p_event,
 		}
 		}
 	}
 	}
 
 
-	Input::get_singleton()->accumulate_input_event(k);
+	Input::get_singleton()->parse_input_event(k);
 }
 }
 
 
 Atom DisplayServerX11::_process_selection_request_target(Atom p_target, Window p_requestor, Atom p_property) const {
 Atom DisplayServerX11::_process_selection_request_target(Atom p_target, Window p_requestor, Atom p_property) const {
@@ -2883,13 +2883,13 @@ void DisplayServerX11::process_events() {
 								// in a spurious mouse motion event being sent to Godot; remember it to be able to filter it out
 								// in a spurious mouse motion event being sent to Godot; remember it to be able to filter it out
 								xi.mouse_pos_to_filter = pos;
 								xi.mouse_pos_to_filter = pos;
 							}
 							}
-							Input::get_singleton()->accumulate_input_event(st);
+							Input::get_singleton()->parse_input_event(st);
 						} else {
 						} else {
 							if (!xi.state.has(index)) { // Defensive
 							if (!xi.state.has(index)) { // Defensive
 								break;
 								break;
 							}
 							}
 							xi.state.erase(index);
 							xi.state.erase(index);
-							Input::get_singleton()->accumulate_input_event(st);
+							Input::get_singleton()->parse_input_event(st);
 						}
 						}
 					} break;
 					} break;
 
 
@@ -2906,7 +2906,7 @@ void DisplayServerX11::process_events() {
 							sd->set_index(index);
 							sd->set_index(index);
 							sd->set_position(pos);
 							sd->set_position(pos);
 							sd->set_relative(pos - curr_pos_elem->value());
 							sd->set_relative(pos - curr_pos_elem->value());
-							Input::get_singleton()->accumulate_input_event(sd);
+							Input::get_singleton()->parse_input_event(sd);
 
 
 							curr_pos_elem->value() = pos;
 							curr_pos_elem->value() = pos;
 						}
 						}
@@ -3058,7 +3058,7 @@ void DisplayServerX11::process_events() {
 					st->set_index(E->key());
 					st->set_index(E->key());
 					st->set_window_id(window_id);
 					st->set_window_id(window_id);
 					st->set_position(E->get());
 					st->set_position(E->get());
-					Input::get_singleton()->accumulate_input_event(st);
+					Input::get_singleton()->parse_input_event(st);
 				}
 				}
 				xi.state.clear();
 				xi.state.clear();
 #endif
 #endif
@@ -3156,7 +3156,7 @@ void DisplayServerX11::process_events() {
 									mb->set_window_id(window_id_other);
 									mb->set_window_id(window_id_other);
 									mb->set_position(Vector2(x, y));
 									mb->set_position(Vector2(x, y));
 									mb->set_global_position(mb->get_position());
 									mb->set_global_position(mb->get_position());
-									Input::get_singleton()->accumulate_input_event(mb);
+									Input::get_singleton()->parse_input_event(mb);
 								}
 								}
 								break;
 								break;
 							}
 							}
@@ -3164,7 +3164,7 @@ void DisplayServerX11::process_events() {
 					}
 					}
 				}
 				}
 
 
-				Input::get_singleton()->accumulate_input_event(mb);
+				Input::get_singleton()->parse_input_event(mb);
 
 
 			} break;
 			} break;
 			case MotionNotify: {
 			case MotionNotify: {
@@ -3280,7 +3280,7 @@ void DisplayServerX11::process_events() {
 				// this is so that the relative motion doesn't get messed up
 				// this is so that the relative motion doesn't get messed up
 				// after we regain focus.
 				// after we regain focus.
 				if (focused) {
 				if (focused) {
-					Input::get_singleton()->accumulate_input_event(mm);
+					Input::get_singleton()->parse_input_event(mm);
 				} else {
 				} else {
 					// Propagate the event to the focused window,
 					// Propagate the event to the focused window,
 					// because it's received only on the topmost window.
 					// because it's received only on the topmost window.
@@ -3300,7 +3300,7 @@ void DisplayServerX11::process_events() {
 							mm->set_position(pos_focused);
 							mm->set_position(pos_focused);
 							mm->set_global_position(pos_focused);
 							mm->set_global_position(pos_focused);
 							mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
 							mm->set_speed(Input::get_singleton()->get_last_mouse_speed());
-							Input::get_singleton()->accumulate_input_event(mm);
+							Input::get_singleton()->parse_input_event(mm);
 
 
 							break;
 							break;
 						}
 						}

+ 8 - 8
platform/osx/display_server_osx.mm

@@ -690,7 +690,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, M
 		mb->set_double_click([event clickCount] == 2);
 		mb->set_double_click([event clickCount] == 2);
 	}
 	}
 
 
-	Input::get_singleton()->accumulate_input_event(mb);
+	Input::get_singleton()->parse_input_event(mb);
 }
 }
 
 
 - (void)mouseDown:(NSEvent *)event {
 - (void)mouseDown:(NSEvent *)event {
@@ -799,7 +799,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, M
 	_get_key_modifier_state([event modifierFlags], mm);
 	_get_key_modifier_state([event modifierFlags], mm);
 
 
 	Input::get_singleton()->set_mouse_position(wd.mouse_pos);
 	Input::get_singleton()->set_mouse_position(wd.mouse_pos);
-	Input::get_singleton()->accumulate_input_event(mm);
+	Input::get_singleton()->parse_input_event(mm);
 }
 }
 
 
 - (void)rightMouseDown:(NSEvent *)event {
 - (void)rightMouseDown:(NSEvent *)event {
@@ -875,7 +875,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, M
 	ev->set_position(_get_mouse_pos(wd, [event locationInWindow]));
 	ev->set_position(_get_mouse_pos(wd, [event locationInWindow]));
 	ev->set_factor([event magnification] + 1.0);
 	ev->set_factor([event magnification] + 1.0);
 
 
-	Input::get_singleton()->accumulate_input_event(ev);
+	Input::get_singleton()->parse_input_event(ev);
 }
 }
 
 
 - (void)viewDidChangeBackingProperties {
 - (void)viewDidChangeBackingProperties {
@@ -1357,7 +1357,7 @@ inline void sendScrollEvent(DisplayServer::WindowID window_id, MouseButton butto
 	DS_OSX->last_button_state |= (MouseButton)mask;
 	DS_OSX->last_button_state |= (MouseButton)mask;
 	sc->set_button_mask(DS_OSX->last_button_state);
 	sc->set_button_mask(DS_OSX->last_button_state);
 
 
-	Input::get_singleton()->accumulate_input_event(sc);
+	Input::get_singleton()->parse_input_event(sc);
 
 
 	sc.instantiate();
 	sc.instantiate();
 	sc->set_window_id(window_id);
 	sc->set_window_id(window_id);
@@ -1369,7 +1369,7 @@ inline void sendScrollEvent(DisplayServer::WindowID window_id, MouseButton butto
 	DS_OSX->last_button_state &= (MouseButton)~mask;
 	DS_OSX->last_button_state &= (MouseButton)~mask;
 	sc->set_button_mask(DS_OSX->last_button_state);
 	sc->set_button_mask(DS_OSX->last_button_state);
 
 
-	Input::get_singleton()->accumulate_input_event(sc);
+	Input::get_singleton()->parse_input_event(sc);
 }
 }
 
 
 inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy, int modifierFlags) {
 inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy, int modifierFlags) {
@@ -1384,7 +1384,7 @@ inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy
 	pg->set_position(wd.mouse_pos);
 	pg->set_position(wd.mouse_pos);
 	pg->set_delta(Vector2(-dx, -dy));
 	pg->set_delta(Vector2(-dx, -dy));
 
 
-	Input::get_singleton()->accumulate_input_event(pg);
+	Input::get_singleton()->parse_input_event(pg);
 }
 }
 
 
 - (void)scrollWheel:(NSEvent *)event {
 - (void)scrollWheel:(NSEvent *)event {
@@ -3198,7 +3198,7 @@ String DisplayServerOSX::keyboard_get_layout_name(int p_index) const {
 
 
 void DisplayServerOSX::_push_input(const Ref<InputEvent> &p_event) {
 void DisplayServerOSX::_push_input(const Ref<InputEvent> &p_event) {
 	Ref<InputEvent> ev = p_event;
 	Ref<InputEvent> ev = p_event;
-	Input::get_singleton()->accumulate_input_event(ev);
+	Input::get_singleton()->parse_input_event(ev);
 }
 }
 
 
 void DisplayServerOSX::_release_pressed_events() {
 void DisplayServerOSX::_release_pressed_events() {
@@ -3253,7 +3253,7 @@ void DisplayServerOSX::_send_event(NSEvent *p_event) {
 			k->set_physical_keycode(KEY_PERIOD);
 			k->set_physical_keycode(KEY_PERIOD);
 			k->set_echo([p_event isARepeat]);
 			k->set_echo([p_event isARepeat]);
 
 
-			Input::get_singleton()->accumulate_input_event(k);
+			Input::get_singleton()->parse_input_event(k);
 		}
 		}
 	}
 	}
 }
 }

+ 10 - 10
platform/windows/display_server_windows.cpp

@@ -1738,7 +1738,7 @@ void DisplayServerWindows::_touch_event(WindowID p_window, bool p_pressed, float
 	event->set_pressed(p_pressed);
 	event->set_pressed(p_pressed);
 	event->set_position(Vector2(p_x, p_y));
 	event->set_position(Vector2(p_x, p_y));
 
 
-	Input::get_singleton()->accumulate_input_event(event);
+	Input::get_singleton()->parse_input_event(event);
 }
 }
 
 
 void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y, int idx) {
 void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y, int idx) {
@@ -1757,7 +1757,7 @@ void DisplayServerWindows::_drag_event(WindowID p_window, float p_x, float p_y,
 	event->set_position(Vector2(p_x, p_y));
 	event->set_position(Vector2(p_x, p_y));
 	event->set_relative(Vector2(p_x, p_y) - curr->get());
 	event->set_relative(Vector2(p_x, p_y) - curr->get());
 
 
-	Input::get_singleton()->accumulate_input_event(event);
+	Input::get_singleton()->parse_input_event(event);
 
 
 	curr->get() = Vector2(p_x, p_y);
 	curr->get() = Vector2(p_x, p_y);
 }
 }
@@ -2022,7 +2022,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
 				}
 				}
 
 
 				if (windows[window_id].window_has_focus && mm->get_relative() != Vector2())
 				if (windows[window_id].window_has_focus && mm->get_relative() != Vector2())
-					Input::get_singleton()->accumulate_input_event(mm);
+					Input::get_singleton()->parse_input_event(mm);
 			}
 			}
 			delete[] lpb;
 			delete[] lpb;
 		} break;
 		} break;
@@ -2111,7 +2111,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
 					old_x = mm->get_position().x;
 					old_x = mm->get_position().x;
 					old_y = mm->get_position().y;
 					old_y = mm->get_position().y;
 					if (windows[window_id].window_has_focus)
 					if (windows[window_id].window_has_focus)
-						Input::get_singleton()->accumulate_input_event(mm);
+						Input::get_singleton()->parse_input_event(mm);
 				}
 				}
 				return 0;
 				return 0;
 			}
 			}
@@ -2258,7 +2258,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
 			old_x = mm->get_position().x;
 			old_x = mm->get_position().x;
 			old_y = mm->get_position().y;
 			old_y = mm->get_position().y;
 			if (windows[window_id].window_has_focus) {
 			if (windows[window_id].window_has_focus) {
-				Input::get_singleton()->accumulate_input_event(mm);
+				Input::get_singleton()->parse_input_event(mm);
 			}
 			}
 
 
 			return 0; //Pointer event handled return 0 to avoid duplicate WM_MOUSEMOVE event
 			return 0; //Pointer event handled return 0 to avoid duplicate WM_MOUSEMOVE event
@@ -2364,7 +2364,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
 			old_x = mm->get_position().x;
 			old_x = mm->get_position().x;
 			old_y = mm->get_position().y;
 			old_y = mm->get_position().y;
 			if (windows[window_id].window_has_focus)
 			if (windows[window_id].window_has_focus)
-				Input::get_singleton()->accumulate_input_event(mm);
+				Input::get_singleton()->parse_input_event(mm);
 
 
 		} break;
 		} break;
 		case WM_LBUTTONDOWN:
 		case WM_LBUTTONDOWN:
@@ -2533,7 +2533,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
 
 
 			mb->set_global_position(mb->get_position());
 			mb->set_global_position(mb->get_position());
 
 
-			Input::get_singleton()->accumulate_input_event(mb);
+			Input::get_singleton()->parse_input_event(mb);
 			if (mb->is_pressed() && mb->get_button_index() > 3 && mb->get_button_index() < 8) {
 			if (mb->is_pressed() && mb->get_button_index() > 3 && mb->get_button_index() < 8) {
 				//send release for mouse wheel
 				//send release for mouse wheel
 				Ref<InputEventMouseButton> mbd = mb->duplicate();
 				Ref<InputEventMouseButton> mbd = mb->duplicate();
@@ -2541,7 +2541,7 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
 				last_button_state &= (MouseButton) ~(1 << (mbd->get_button_index() - 1));
 				last_button_state &= (MouseButton) ~(1 << (mbd->get_button_index() - 1));
 				mbd->set_button_mask(last_button_state);
 				mbd->set_button_mask(last_button_state);
 				mbd->set_pressed(false);
 				mbd->set_pressed(false);
-				Input::get_singleton()->accumulate_input_event(mbd);
+				Input::get_singleton()->parse_input_event(mbd);
 			}
 			}
 
 
 		} break;
 		} break;
@@ -2866,7 +2866,7 @@ void DisplayServerWindows::_process_key_events() {
 					if (k->get_unicode() < 32)
 					if (k->get_unicode() < 32)
 						k->set_unicode(0);
 						k->set_unicode(0);
 
 
-					Input::get_singleton()->accumulate_input_event(k);
+					Input::get_singleton()->parse_input_event(k);
 				}
 				}
 
 
 				//do nothing
 				//do nothing
@@ -2924,7 +2924,7 @@ void DisplayServerWindows::_process_key_events() {
 
 
 				k->set_echo((ke.uMsg == WM_KEYDOWN && (ke.lParam & (1 << 30))));
 				k->set_echo((ke.uMsg == WM_KEYDOWN && (ke.lParam & (1 << 30))));
 
 
-				Input::get_singleton()->accumulate_input_event(k);
+				Input::get_singleton()->parse_input_event(k);
 
 
 			} break;
 			} break;
 		}
 		}