Avoid calling focus_in when creating window

This is redundant because when creating a window we will receive
an activation event if the window was effectively focused. And if
it wasn't, we shouldn't call `focus_in`.
This commit is contained in:
Antonio Scandurra 2023-04-17 11:56:14 +02:00
parent f09e21aa93
commit bed94455b9

View File

@ -1272,12 +1272,7 @@ impl AppContext {
.open_window(window_id, window_options, this.foreground.clone());
let window = this.build_window(window_id, platform_window, build_root_view);
let root_view = window.root_view().clone().downcast::<V>().unwrap();
this.windows.insert(window_id, window);
this.update_window(window_id, |cx| {
root_view.update(cx, |view, cx| view.focus_in(cx.handle().into_any(), cx))
});
(window_id, root_view)
})
}