diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c index 2c897fb883..5606b9920f 100644 --- a/gdk/quartz/GdkQuartzView.c +++ b/gdk/quartz/GdkQuartzView.c @@ -154,15 +154,6 @@ owner:self userData:nil assumeInside:NO]; - - if (NSPointInRect ([[self window] convertScreenToBase:[NSEvent mouseLocation]], rect)) - { - /* When a new window (and thus view) has been created, and the mouse - * is in the window area, we will not receive an NSMouseEntered - * event. Therefore, we synthesize an enter notify event manually. - */ - _gdk_quartz_events_send_enter_notify_event (gdk_window); - } } -(void)viewDidMoveToWindow diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c index f7593baaa3..06d11cfe00 100644 --- a/gdk/quartz/GdkQuartzWindow.c +++ b/gdk/quartz/GdkQuartzWindow.c @@ -142,6 +142,24 @@ return inMove; } +-(void)checkSendEnterNotify +{ + /* When a new window has been created, and the mouse + * is in the window area, we will not receive an NSMouseEntered + * event. Therefore, we synthesize an enter notify event manually. + */ + if (!initialPositionKnown) + { + initialPositionKnown = YES; + + if (NSPointInRect ([NSEvent mouseLocation], [self frame])) + { + GdkWindow *window = [[self contentView] gdkWindow]; + _gdk_quartz_events_send_enter_notify_event (window); + } + } +} + -(void)windowDidMove:(NSNotification *)aNotification { GdkWindow *window = [[self contentView] gdkWindow]; @@ -159,6 +177,8 @@ event->configure.height = private->height; _gdk_event_queue_append (gdk_display_get_default (), event); + + [self checkSendEnterNotify]; } -(void)windowDidResize:(NSNotification *)aNotification @@ -189,6 +209,8 @@ event->configure.height = private->height; _gdk_event_queue_append (gdk_display_get_default (), event); + + [self checkSendEnterNotify]; } -(id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag screen:(NSScreen *)screen diff --git a/gdk/quartz/GdkQuartzWindow.h b/gdk/quartz/GdkQuartzWindow.h index 974e57253f..9cdee6ba31 100644 --- a/gdk/quartz/GdkQuartzWindow.h +++ b/gdk/quartz/GdkQuartzWindow.h @@ -25,6 +25,7 @@ @interface GdkQuartzWindow : NSWindow { BOOL inMove; BOOL inShowOrHide; + BOOL initialPositionKnown; /* Manually triggered move/resize (not by the window manager) */ BOOL inManualMove;