1
0
Fork 0

macOS: fix build

This commit is contained in:
William Light 2020-09-11 18:38:55 +02:00
parent bc79e42314
commit 409b03cfdb

View file

@ -25,8 +25,8 @@ pub struct WindowHandle;
impl WindowHandle {
pub fn app_run_blocking(self) {
unsafe {
let current_app = NSRunningApplication::currentApplication(nil);
current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);
let app = NSApp();
app.setActivationPolicy_(NSApplicationActivationPolicyRegular);
app.run();
}
}
@ -37,9 +37,6 @@ impl Window {
unsafe {
let _pool = NSAutoreleasePool::new(nil);
let app = NSApp();
app.setActivationPolicy_(NSApplicationActivationPolicyRegular);
let rect = NSRect::new(
NSPoint::new(0.0, 0.0),
NSSize::new(options.width as f64, options.height as f64),
@ -54,7 +51,7 @@ impl Window {
)
.autorelease();
ns_window.center();
ns_window.setTitle_(NSString::alloc(nil).init_str(options.title));
ns_window.setTitle_(NSString::alloc(nil).init_str(&options.title));
ns_window.makeKeyAndOrderFront_(nil);
let ns_view = NSView::alloc(nil).init();
@ -64,6 +61,10 @@ impl Window {
let handler = H::build(&mut window);
// FIXME: only do this in the unparented case
let current_app = NSRunningApplication::currentApplication(nil);
current_app.activateWithOptions_(NSApplicationActivateIgnoringOtherApps);
WindowHandle
}
}