@@ -26,7 +26,7 @@ use platform::macos::{ActivationPolicy, WindowExtMacOS};
2626use platform_impl:: platform:: {
2727 app_state:: AppState , ffi, monitor:: { self , MonitorHandle } ,
2828 util:: { self , IdRef } , view:: { self , new_view} ,
29- window_delegate:: { WindowDelegate , WindowDelegateState } ,
29+ window_delegate:: new_delegate ,
3030} ;
3131
3232#[ derive( Debug , Copy , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
@@ -93,7 +93,7 @@ fn create_window(
9393 pl_attrs : & PlatformSpecificWindowBuilderAttributes ,
9494) -> Option < IdRef > {
9595 unsafe {
96- let autoreleasepool = NSAutoreleasePool :: new ( nil) ;
96+ let pool = NSAutoreleasePool :: new ( nil) ;
9797 let screen = match attrs. fullscreen {
9898 Some ( ref monitor_id) => {
9999 let monitor_screen = monitor_id. inner . get_nsscreen ( ) ;
@@ -185,7 +185,7 @@ fn create_window(
185185 nswindow. center ( ) ;
186186 nswindow
187187 } ) ;
188- let _ : ( ) = msg_send ! [ autoreleasepool , drain ] ;
188+ pool . drain ( ) ;
189189 res
190190 }
191191}
@@ -247,7 +247,7 @@ impl UnownedWindow {
247247 pub fn new (
248248 mut win_attribs : WindowAttributes ,
249249 pl_attribs : PlatformSpecificWindowBuilderAttributes ,
250- ) -> Result < ( Arc < Self > , WindowDelegate ) , CreationError > {
250+ ) -> Result < ( Arc < Self > , IdRef ) , CreationError > {
251251 unsafe {
252252 if !msg_send ! [ class!( NSThread ) , isMainThread] {
253253 panic ! ( "Windows can only be created on the main thread on macOS" ) ;
@@ -286,7 +286,7 @@ impl UnownedWindow {
286286
287287 use cocoa:: foundation:: NSArray ;
288288 // register for drag and drop operations.
289- let _ : ( ) = msg_send ! [ * nswindow, registerForDraggedTypes: NSArray :: arrayWithObject(
289+ let ( ) = msg_send ! [ * nswindow, registerForDraggedTypes: NSArray :: arrayWithObject(
290290 nil,
291291 appkit:: NSFilenamesPboardType ,
292292 ) ] ;
@@ -312,10 +312,7 @@ impl UnownedWindow {
312312 cursor_hidden : Default :: default ( ) ,
313313 } ) ;
314314
315- let delegate = WindowDelegate :: new ( WindowDelegateState :: new (
316- & window,
317- fullscreen. is_some ( ) ,
318- ) ) ;
315+ let delegate = new_delegate ( & window, fullscreen. is_some ( ) ) ;
319316
320317 // Set fullscreen mode after we setup everything
321318 if let Some ( monitor) = fullscreen {
@@ -344,7 +341,7 @@ impl UnownedWindow {
344341 window. set_maximized ( maximized) ;
345342 }
346343
347- let _ : ( ) = unsafe { msg_send ! [ pool, drain] } ;
344+ unsafe { pool. drain ( ) } ;
348345
349346 Ok ( ( window, delegate) )
350347 }
@@ -550,7 +547,7 @@ impl UnownedWindow {
550547
551548 // Roll back temp styles
552549 if needs_temp_mask {
553- self . set_style_mask_sync ( curr_mask) ;
550+ self . set_style_mask_async ( curr_mask) ;
554551 }
555552
556553 is_zoomed != 0
@@ -617,6 +614,7 @@ impl UnownedWindow {
617614 NSSize :: new ( 800.0 , 600.0 ) ,
618615 ) )
619616 } ;
617+ // This probably isn't thread-safe!
620618 self . nswindow . setFrame_display_ ( new_rect, 0 ) ;
621619 }
622620 }
0 commit comments