Skip to content

Commit

Permalink
Fix that the focus-out notification got sent deferred
Browse files Browse the repository at this point in the history
Currently the window receives a focus-out notification, directly after
it popup, because currently the signal is sent deferred.
The original intention was that the previously focused window must
receive a focus-out notification.
This change makes the notification more precise by only sending the
focus-out to the previously focused window.
  • Loading branch information
Sauermann committed Jun 18, 2023
1 parent a83eb16 commit 8cdab04
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,15 @@ void Window::popup(const Rect2i &p_screen_rect) {
// Send a focus-out notification when opening a Window Manager Popup.
SceneTree *scene_tree = get_tree();
if (scene_tree) {
scene_tree->notify_group_flags(SceneTree::GROUP_CALL_DEFERRED, "_viewports", NOTIFICATION_WM_WINDOW_FOCUS_OUT);
List<Node *> list;
scene_tree->get_nodes_in_group("_viewports", &list);
for (Node *n : list) {
Window *w = Object::cast_to<Window>(n);
if (w && !w->get_embedder() && w->has_focus()) {
w->_event_callback(DisplayServer::WINDOW_EVENT_FOCUS_OUT);
break;
}
}
}
}

Expand Down

0 comments on commit 8cdab04

Please sign in to comment.