diff options
author | Markus Sauermann <6299227+Sauermann@users.noreply.github.com> | 2024-02-29 00:54:37 +0100 |
---|---|---|
committer | Markus Sauermann <6299227+Sauermann@users.noreply.github.com> | 2024-02-29 00:57:31 +0100 |
commit | d259f979f513d8b4730ff8b40f976b8ae8973dd2 (patch) | |
tree | 9955e894c09d727d0d90fc131b5cbc2686da80d7 | |
parent | df78c0636d79c9545a283e0e2a926d623998cc27 (diff) | |
download | redot-engine-d259f979f513d8b4730ff8b40f976b8ae8973dd2.tar.gz |
Fix mouse entered notifications
Make sure, that a windows initial state is `mouse_in_viewport = false`.
This makes sure, that the mouse entered notification is sent when the
mouse hovers a window for the first time.
For embedded Windows, `NOTIFICATION_WM_MOUSE_ENTER` is currently sent
twice in a row. Remove one of the places where it is sent.
`Window::_update_mouse_over()` is the correct one, because there it is
also called for native windows.
-rw-r--r-- | scene/main/viewport.cpp | 3 | ||||
-rw-r--r-- | scene/main/viewport.h | 2 |
2 files changed, 1 insertions, 4 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 1dcf9acda3..18c998d7cb 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -3158,9 +3158,6 @@ void Viewport::_update_mouse_over(Vector2 p_pos) { gui.subwindow_over->_mouse_leave_viewport(); } gui.subwindow_over = sw; - if (!sw->is_input_disabled()) { - sw->_propagate_window_notification(sw, NOTIFICATION_WM_MOUSE_ENTER); - } } if (!sw->is_input_disabled()) { sw->_update_mouse_over(sw->get_final_transform().affine_inverse().xform(p_pos - sw->get_position())); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 03db0d4023..2904e3e156 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -352,7 +352,7 @@ private: struct GUI { bool forced_mouse_focus = false; //used for menu buttons - bool mouse_in_viewport = true; + bool mouse_in_viewport = false; bool key_event_accepted = false; HashMap<int, ObjectID> touch_focus; Control *mouse_focus = nullptr; |