summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Rietveld <kris@lanedo.com>2012-06-03 15:19:27 +0200
committerKristian Rietveld <kris@loopnest.org>2012-06-11 21:10:19 +0200
commit860499ce90a6f184181f2e7249871e2514c83e00 (patch)
treef13b6d40d5e01ed1fa7865c99a844501e82a5726
parent0b59fbfb9d677b77b392c0c6d327ddecd7978d89 (diff)
downloadgtk+-860499ce90a6f184181f2e7249871e2514c83e00.tar.gz
quartz: delay emission of EnterNotify until window position is known
Beforehand, the check whether or not emission is necessary was done based on the "uninitialized" window position in the top left corner. We now wait until the window size is set for the first time, to avoid emitting EnterNotify when it is not necessary.
-rw-r--r--gdk/quartz/GdkQuartzView.c9
-rw-r--r--gdk/quartz/GdkQuartzWindow.c22
-rw-r--r--gdk/quartz/GdkQuartzWindow.h1
3 files changed, 23 insertions, 9 deletions
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;