diff options
author | Michael Natterer <mitch@gimp.org> | 2012-11-20 10:28:58 +0100 |
---|---|---|
committer | Michael Natterer <mitch@gimp.org> | 2012-11-20 10:28:58 +0100 |
commit | 2d5ad5f54e7e78fd35ef09b4ce055af9f6d9aa0a (patch) | |
tree | fbb68ea16de7fda3d47ae11c89b7d6427522852d /gdk/quartz/GdkQuartzNSWindow.c | |
parent | 352c7f5120d8ee4237692acf1dc0acf4c7b1bf11 (diff) | |
download | gtk+-2d5ad5f54e7e78fd35ef09b4ce055af9f6d9aa0a.tar.gz |
Bug 672193 - windows (including menus) shown multiple times don't...
Based on a patch from Paul Davis, inject synthetic enter events directly
into the Quartz event stream, instead of trying to synthesize them in GDK.
This seems to magically fix most combo box popup weirdness, I guess
some code is relying on a specfic order of events, or any other state
imposed by the "proper" code path of events coming in the usual way.
The patch also removes _gdk_quartz_events_send_enter_notify_event()
which is now obsolete.
(sortof cherry-pixked from 979e5061a040f8896f505ffbd230f52af2d61ded
but needed manual editing because GdkQuartzWindow.c was renamed
and apparently earlier patches not picked correctly/completely)
Diffstat (limited to 'gdk/quartz/GdkQuartzNSWindow.c')
-rw-r--r-- | gdk/quartz/GdkQuartzNSWindow.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gdk/quartz/GdkQuartzNSWindow.c b/gdk/quartz/GdkQuartzNSWindow.c index 76a759ccc0..b5eaae25e7 100644 --- a/gdk/quartz/GdkQuartzNSWindow.c +++ b/gdk/quartz/GdkQuartzNSWindow.c @@ -141,6 +141,38 @@ return inMove; } +-(void)checkSendEnterNotify +{ + GdkWindow *window = [[self contentView] gdkWindow]; + GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl); + + /* 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])) + { + NSEvent *event; + + event = [NSEvent enterExitEventWithType: NSMouseEntered + location: [self mouseLocationOutsideOfEventStream] + modifierFlags: 0 + timestamp: [[NSApp currentEvent] timestamp] + windowNumber: [impl->toplevel windowNumber] + context: NULL + eventNumber: 0 + trackingNumber: [impl->view trackingRect] + userData: nil]; + + [NSApp postEvent:event atStart:NO]; + } + } +} + -(void)windowDidMove:(NSNotification *)aNotification { GdkWindow *window = [[self contentView] gdkWindow]; @@ -157,6 +189,8 @@ event->configure.height = window->height; _gdk_event_queue_append (gdk_display_get_default (), event); + + [self checkSendEnterNotify]; } -(void)windowDidResize:(NSNotification *)aNotification @@ -186,6 +220,8 @@ event->configure.height = window->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 @@ -283,6 +319,8 @@ [impl->toplevel orderFront:nil]; inShowOrHide = NO; + + [self checkSendEnterNotify]; } - (void)hide @@ -293,6 +331,8 @@ inShowOrHide = YES; [impl->toplevel orderOut:nil]; inShowOrHide = NO; + + initialPositionKnown = NO; } - (BOOL)trackManualMove |