mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
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:
parent
0b59fbfb9d
commit
860499ce90
@ -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
|
||||
|
@ -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
|
||||
|
@ -25,6 +25,7 @@
|
||||
@interface GdkQuartzWindow : NSWindow {
|
||||
BOOL inMove;
|
||||
BOOL inShowOrHide;
|
||||
BOOL initialPositionKnown;
|
||||
|
||||
/* Manually triggered move/resize (not by the window manager) */
|
||||
BOOL inManualMove;
|
||||
|
Loading…
Reference in New Issue
Block a user