Skip to content

Commit

Permalink
[Window] Fix mouse hover state of the main window when mouse enter ev…
Browse files Browse the repository at this point in the history
…ent was sent before setting callbacks.
  • Loading branch information
bruvzg committed Jun 10, 2024
1 parent 5241d30 commit 768fd1e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1354,6 +1354,10 @@ void Window::_notification(int p_what) {
_update_window_size(); // Inform DisplayServer of minimum and maximum size.
_update_viewport_size(); // Then feed back to the viewport.
_update_window_callbacks();
// Simulate mouse-enter event when mouse is over the window, since OS event might arrive before setting callbacks.
if (!mouse_in_window && Rect2(position, size).has_point(DisplayServer::get_singleton()->mouse_get_position())) {
_event_callback(DisplayServer::WINDOW_EVENT_MOUSE_ENTER);
}
RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::VIEWPORT_UPDATE_WHEN_VISIBLE);
if (DisplayServer::get_singleton()->window_get_flag(DisplayServer::WindowFlags(FLAG_TRANSPARENT), window_id)) {
set_transparent_background(true);
Expand Down

0 comments on commit 768fd1e

Please sign in to comment.