[gtk+/gtk-2-24] Bug 672193 - windows (including menus) shown multiple times don't...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-24] Bug 672193 - windows (including menus) shown multiple times don't...
- Date: Tue, 20 Nov 2012 09:07:16 +0000 (UTC)
commit 979e5061a040f8896f505ffbd230f52af2d61ded
Author: Michael Natterer <mitch lanedo com>
Date: Thu Nov 8 15:11:55 2012 +0100
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.
gdk/quartz/GdkQuartzWindow.c | 23 +++++++++++++++++++++--
gdk/quartz/gdkevents-quartz.c | 31 -------------------------------
gdk/quartz/gdkprivate-quartz.h | 1 -
3 files changed, 21 insertions(+), 34 deletions(-)
---
diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzWindow.c
index 06d11cf..7c08712 100644
--- a/gdk/quartz/GdkQuartzWindow.c
+++ b/gdk/quartz/GdkQuartzWindow.c
@@ -144,6 +144,10 @@
-(void)checkSendEnterNotify
{
+ GdkWindow *window = [[self contentView] gdkWindow];
+ GdkWindowObject *private = (GdkWindowObject *)window;
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->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.
@@ -154,8 +158,19 @@
if (NSPointInRect ([NSEvent mouseLocation], [self frame]))
{
- GdkWindow *window = [[self contentView] gdkWindow];
- _gdk_quartz_events_send_enter_notify_event (window);
+ 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];
}
}
}
@@ -311,6 +326,8 @@
[impl->toplevel orderFront:nil];
inShowOrHide = NO;
+
+ [self checkSendEnterNotify];
}
- (void)hide
@@ -322,6 +339,8 @@
inShowOrHide = YES;
[impl->toplevel orderOut:nil];
inShowOrHide = NO;
+
+ initialPositionKnown = NO;
}
- (BOOL)trackManualMove
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index aedd194..2cebd32 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -642,37 +642,6 @@ _gdk_quartz_events_update_focus_window (GdkWindow *window,
}
void
-_gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
-{
- NSPoint screen_point;
- GdkEvent *event;
- gint x, y, x_root, y_root;
-
- event = gdk_event_new (GDK_ENTER_NOTIFY);
- event->any.window = NULL;
- event->any.send_event = FALSE;
-
- screen_point = [NSEvent mouseLocation];
-
- _gdk_quartz_window_nspoint_to_gdk_xy (screen_point, &x_root, &y_root);
- get_window_point_from_screen_point (window, screen_point, &x, &y);
-
- event->crossing.window = window;
- event->crossing.subwindow = NULL;
- event->crossing.time = GDK_CURRENT_TIME;
- event->crossing.x = x;
- event->crossing.y = y;
- event->crossing.x_root = x_root;
- event->crossing.y_root = y_root;
- event->crossing.mode = GDK_CROSSING_NORMAL;
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- event->crossing.state = _gdk_quartz_events_get_current_keyboard_modifiers () |
- _gdk_quartz_events_get_current_mouse_modifiers ();
-
- append_event (event, TRUE);
-}
-
-void
_gdk_quartz_events_send_map_event (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index 03bba91..af0931a 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -178,7 +178,6 @@ GdkEventMask _gdk_quartz_events_get_current_event_mask (void);
GdkModifierType _gdk_quartz_events_get_current_keyboard_modifiers (void);
GdkModifierType _gdk_quartz_events_get_current_mouse_modifiers (void);
-void _gdk_quartz_events_send_enter_notify_event (GdkWindow *window);
void _gdk_quartz_events_break_all_grabs (guint32 time);
/* Event loop */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]