浏览代码

Prohibit execution of delayed input events by different means

In some cases it can happen, that the order of input events and
window events is not followed, when input buffering or input accumulation
is active.

The display server order `InputEvent` => window-event gets changed to
window-event => `InputEvent` which becomes problematic in certain
situations.

This PR makes sure, that the order is adhered to by flushing input events
before a window event is sent.
Previously this problem was mitigated by discarding these delayed events.
But this solution was problematic in the setting of android input events.
Markus Sauermann 1 年之前
父节点
当前提交
945babc619
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      scene/main/window.cpp

+ 3 - 3
scene/main/window.cpp

@@ -724,6 +724,9 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) {
 			if (!is_inside_tree()) {
 				return;
 			}
+			// Ensure keeping the order of input events and window events when input events are buffered or accumulated.
+			Input::get_singleton()->flush_buffered_events();
+
 			Window *root = get_tree()->get_root();
 			if (!root->gui.windowmanager_window_over) {
 #ifdef DEV_ENABLED
@@ -2717,9 +2720,6 @@ void Window::_update_mouse_over(Vector2 p_pos) {
 		if (is_embedded()) {
 			mouse_in_window = true;
 			_propagate_window_notification(this, NOTIFICATION_WM_MOUSE_ENTER);
-		} else {
-			// Prevent update based on delayed InputEvents from DisplayServer.
-			return;
 		}
 	}