1
0
Fork 0

macOS: WindowHandle.app_run_blocking()

This commit is contained in:
William Light 2020-09-11 18:33:06 +02:00
parent 888e3bdf0c
commit bc79e42314

View file

@ -20,6 +20,18 @@ pub struct Window {
ns_view: id,
}
pub struct WindowHandle;
impl WindowHandle {
pub fn app_run_blocking(self) {
unsafe {
let current_app = NSRunningApplication::currentApplication(nil);
current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);
app.run();
}
}
}
impl Window {
pub fn open<H: WindowHandler>(options: WindowOpenOptions) -> WindowHandle {
unsafe {
@ -52,10 +64,6 @@ impl Window {
let handler = H::build(&mut window);
let current_app = NSRunningApplication::currentApplication(nil);
current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);
app.run();
WindowHandle
}
}
@ -70,5 +78,3 @@ unsafe impl HasRawWindowHandle for Window {
})
}
}
pub struct WindowHandle;