@@ -349,6 +349,18 @@ impl WindowBuilder {
349
349
let frame = NSView :: frame ( content_view) ;
350
350
view. initWithFrame_ ( frame) ;
351
351
352
+ // The rect of the tracking area doesn't matter, because
353
+ // we use the InVisibleRect option where the OS syncs the size automatically.
354
+ let rect = NSRect :: new ( NSPoint :: new ( 0. , 0. ) , NSSize :: new ( 0. , 0. ) ) ;
355
+ let opts = NSTrackingAreaOptions :: MouseEnteredAndExited
356
+ | NSTrackingAreaOptions :: MouseMoved
357
+ | NSTrackingAreaOptions :: ActiveAlways
358
+ | NSTrackingAreaOptions :: InVisibleRect ;
359
+ let tracking_area = NSTrackingArea :: alloc ( nil)
360
+ . initWithRect_options_owner_userInfo ( rect, opts, view, nil)
361
+ . autorelease ( ) ;
362
+ view. addTrackingArea ( tracking_area) ;
363
+
352
364
let ( ) = msg_send ! [ window, setDelegate: view] ;
353
365
354
366
if let Some ( menu) = self . menu {
@@ -645,18 +657,6 @@ fn make_view(
645
657
let options: NSAutoresizingMaskOptions = NSViewWidthSizable | NSViewHeightSizable ;
646
658
view. setAutoresizingMask_ ( options) ;
647
659
648
- // The rect of the tracking area doesn't matter, because
649
- // we use the InVisibleRect option where the OS syncs the size automatically.
650
- let rect = NSRect :: new ( NSPoint :: new ( 0. , 0. ) , NSSize :: new ( 0. , 0. ) ) ;
651
- let opts = NSTrackingAreaOptions :: MouseEnteredAndExited
652
- | NSTrackingAreaOptions :: MouseMoved
653
- | NSTrackingAreaOptions :: ActiveAlways
654
- | NSTrackingAreaOptions :: InVisibleRect ;
655
- let tracking_area = NSTrackingArea :: alloc ( nil)
656
- . initWithRect_options_owner_userInfo ( rect, opts, view, nil)
657
- . autorelease ( ) ;
658
- view. addTrackingArea ( tracking_area) ;
659
-
660
660
view. setWantsBestResolutionOpenGLSurface_ ( YES ) ;
661
661
662
662
// On Mojave, views automatically become layer-backed shortly after being added to
0 commit comments