Checkpoint

This commit is contained in:
Nathan Sobo 2023-10-02 13:34:07 -06:00
parent 79e1e1a747
commit 66ef5549e9
6 changed files with 47 additions and 11 deletions

View file

@ -289,6 +289,18 @@ impl MainThread<AppContext> {
})
}
pub(crate) fn update_window<R>(
&mut self,
id: WindowId,
update: impl FnOnce(&mut WindowContext) -> R,
) -> Result<R> {
self.0.update_window(id, |cx| {
update(unsafe {
std::mem::transmute::<&mut WindowContext, &mut MainThread<WindowContext>>(cx)
})
})
}
pub(crate) fn platform(&self) -> &dyn Platform {
self.platform.borrow_on_main_thread()
}