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.
This commit is contained in:
Kristian Rietveld 2012-06-03 15:19:27 +02:00 committed by Kristian Rietveld
parent 0b59fbfb9d
commit 860499ce90
3 changed files with 23 additions and 9 deletions

View File

@ -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

View File

@ -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

View File

@ -25,6 +25,7 @@
@interface GdkQuartzWindow : NSWindow {
BOOL inMove;
BOOL inShowOrHide;
BOOL initialPositionKnown;
/* Manually triggered move/resize (not by the window manager) */
BOOL inManualMove;