mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Open platform window before first invalidation
This ensures we have an invalidation handler present so we render the first frame in all cases.
This commit is contained in:
parent
a5b39220a4
commit
765c3f9c18
1 changed files with 8 additions and 3 deletions
|
@ -380,6 +380,7 @@ impl MutableAppContext {
|
||||||
) {
|
) {
|
||||||
self.invalidation_callbacks
|
self.invalidation_callbacks
|
||||||
.insert(window_id, Box::new(callback));
|
.insert(window_id, Box::new(callback));
|
||||||
|
self.update_windows();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_action<S, V, T, F>(&mut self, name: S, mut handler: F)
|
pub fn add_action<S, V, T, F>(&mut self, name: S, mut handler: F)
|
||||||
|
@ -612,13 +613,19 @@ impl MutableAppContext {
|
||||||
T: View,
|
T: View,
|
||||||
F: FnOnce(&mut ViewContext<T>) -> T,
|
F: FnOnce(&mut ViewContext<T>) -> T,
|
||||||
{
|
{
|
||||||
|
self.pending_flushes += 1;
|
||||||
let window_id = post_inc(&mut self.next_window_id);
|
let window_id = post_inc(&mut self.next_window_id);
|
||||||
self.ctx.windows.insert(window_id, Window::default());
|
self.ctx.windows.insert(window_id, Window::default());
|
||||||
|
self.open_platform_window(window_id);
|
||||||
let root_handle = self.add_view(window_id, build_root_view);
|
let root_handle = self.add_view(window_id, build_root_view);
|
||||||
self.ctx.windows.get_mut(&window_id).unwrap().root_view = Some(root_handle.clone().into());
|
self.ctx.windows.get_mut(&window_id).unwrap().root_view = Some(root_handle.clone().into());
|
||||||
self.focus(window_id, root_handle.id());
|
self.focus(window_id, root_handle.id());
|
||||||
|
self.flush_effects();
|
||||||
|
|
||||||
|
(window_id, root_handle)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn open_platform_window(&mut self, window_id: usize) {
|
||||||
match self.platform.open_window(
|
match self.platform.open_window(
|
||||||
WindowOptions {
|
WindowOptions {
|
||||||
bounds: RectF::new(vec2f(0., 0.), vec2f(1024., 768.)),
|
bounds: RectF::new(vec2f(0., 0.), vec2f(1024., 768.)),
|
||||||
|
@ -693,8 +700,6 @@ impl MutableAppContext {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(window_id, root_handle)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_view<T, F>(&mut self, window_id: usize, build_view: F) -> ViewHandle<T>
|
pub fn add_view<T, F>(&mut self, window_id: usize, build_view: F) -> ViewHandle<T>
|
||||||
|
|
Loading…
Reference in a new issue