[clutter] osx/stage: Synthesize an enter event on show
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] osx/stage: Synthesize an enter event on show
- Date: Fri, 16 Mar 2012 23:12:42 +0000 (UTC)
commit b6f5609b2f3cc582e499e6d24ed05fe08807592d
Author: Emmanuele Bassi <ebassi gnome org>
Date: Fri Mar 16 23:10:28 2012 +0000
osx/stage: Synthesize an enter event on show
If the pointer is inside the window frame when it's shown then we need
to synthesize and emit a NSMouseEnterEvent ourselves, as Quartz won't
do it for us.
This is a bit of a blind commit - but it's taken from an equivalent
patch that has been verified to work in GDK.
clutter/osx/clutter-stage-osx.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/clutter/osx/clutter-stage-osx.c b/clutter/osx/clutter-stage-osx.c
index 8363ea3..259226d 100644
--- a/clutter/osx/clutter-stage-osx.c
+++ b/clutter/osx/clutter-stage-osx.c
@@ -368,6 +368,7 @@ clutter_stage_osx_show (ClutterStageWindow *stage_window,
{
ClutterStageOSX *self = CLUTTER_STAGE_OSX (stage_window);
BOOL isViewHidden;
+ NSPoint nspoint;
CLUTTER_OSX_POOL_ALLOC();
@@ -390,6 +391,28 @@ clutter_stage_osx_show (ClutterStageWindow *stage_window,
else
[self->window orderFront: nil];
+ /* If the window is placed directly under the mouse pointer, Quartz will
+ * not send a NSMouseEntered event; we can easily synthesize one ourselves
+ * though.
+ */
+ nspoint = [self->window mouseLocationOutsideOfEventStream];
+ if ([self->window mouse:nspoint inRect:[self->view frame]])
+ {
+ NSEvent *event;
+
+ event = [NSEvent enterExitEventWithType: NSMouseEntered
+ location: NSMakePoint(0, 0)
+ modifierFlags: 0
+ timestamp: 0
+ windowNumber: [self->window windowNumber]
+ context: NULL
+ eventNumber: 0
+ trackingNumber: [self->view trackingRect]
+ userData: nil];
+
+ [NSApp postEvent:event atStart:NO];
+ }
+
[self->view setHidden:isViewHidden];
[self->window setExcludedFromWindowsMenu:NO];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]