@@ -290,6 +290,18 @@ impl WindowBuilder {
290
290
let frame = NSView :: frame ( content_view) ;
291
291
view. initWithFrame_ ( frame) ;
292
292
293
+ // The rect of the tracking area doesn't matter, because
294
+ // we use the InVisibleRect option where the OS syncs the size automatically.
295
+ let rect = NSRect :: new ( NSPoint :: new ( 0. , 0. ) , NSSize :: new ( 0. , 0. ) ) ;
296
+ let opts = NSTrackingAreaOptions :: MouseEnteredAndExited
297
+ | NSTrackingAreaOptions :: MouseMoved
298
+ | NSTrackingAreaOptions :: ActiveAlways
299
+ | NSTrackingAreaOptions :: InVisibleRect ;
300
+ let tracking_area = NSTrackingArea :: alloc ( nil)
301
+ . initWithRect_options_owner_userInfo ( rect, opts, view, nil)
302
+ . autorelease ( ) ;
303
+ view. addTrackingArea ( tracking_area) ;
304
+
293
305
let ( ) = msg_send ! [ window, setDelegate: view] ;
294
306
295
307
if let Some ( menu) = self . menu {
@@ -578,18 +590,6 @@ fn make_view(handler: Box<dyn WinHandler>) -> (id, Weak<Mutex<Vec<IdleKind>>>) {
578
590
let options: NSAutoresizingMaskOptions = NSViewWidthSizable | NSViewHeightSizable ;
579
591
view. setAutoresizingMask_ ( options) ;
580
592
581
- // The rect of the tracking area doesn't matter, because
582
- // we use the InVisibleRect option where the OS syncs the size automatically.
583
- let rect = NSRect :: new ( NSPoint :: new ( 0. , 0. ) , NSSize :: new ( 0. , 0. ) ) ;
584
- let opts = NSTrackingAreaOptions :: MouseEnteredAndExited
585
- | NSTrackingAreaOptions :: MouseMoved
586
- | NSTrackingAreaOptions :: ActiveAlways
587
- | NSTrackingAreaOptions :: InVisibleRect ;
588
- let tracking_area = NSTrackingArea :: alloc ( nil)
589
- . initWithRect_options_owner_userInfo ( rect, opts, view, nil)
590
- . autorelease ( ) ;
591
- view. addTrackingArea ( tracking_area) ;
592
-
593
593
( view. autorelease ( ) , queue_handle)
594
594
}
595
595
}
0 commit comments