From 0bbc0740e4bf794e3e8b2d704e3b20380cc73501 Mon Sep 17 00:00:00 2001 From: "blizzard%redhat.com" Date: Tue, 30 Sep 2003 14:58:39 +0000 Subject: [PATCH] Bug #102578. Clicking wrongfully fires onmouseout. Ignore some mouse out events generated by window managers. r=bryner, sr=blizzard --- widget/src/gtk2/nsWindow.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp index 0e5a4f263bd..ed5aa87a58e 100644 --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -97,6 +97,9 @@ static inline PRBool is_context_menu_key(const nsKeyEvent& inKeyEvent); static void key_event_to_context_menu_event(const nsKeyEvent* inKeyEvent, nsMouseEvent* outCMEvent); +static int is_parent_ungrab_enter(GdkEventCrossing *aEvent); +static int is_parent_grab_leave(GdkEventCrossing *aEvent); + /* callbacks from widgets */ static gboolean expose_event_cb (GtkWidget *widget, GdkEventExpose *event); @@ -3127,6 +3130,10 @@ gboolean enter_notify_event_cb (GtkWidget *widget, GdkEventCrossing *event) { + if (is_parent_ungrab_enter(event)) { + return TRUE; + } + nsWindow *window = get_window_for_gdk_window(event->window); if (!window) return TRUE; @@ -3141,6 +3148,10 @@ gboolean leave_notify_event_cb (GtkWidget *widget, GdkEventCrossing *event) { + if (is_parent_grab_leave(event)) { + return TRUE; + } + nsWindow *window = get_window_for_gdk_window(event->window); if (!window) return TRUE; @@ -3679,6 +3690,25 @@ key_event_to_context_menu_event(const nsKeyEvent* aKeyEvent, aCMEvent->acceptActivation = PR_FALSE; } +/* static */ +int +is_parent_ungrab_enter(GdkEventCrossing *aEvent) +{ + return (GDK_CROSSING_UNGRAB == aEvent->mode) && + ((GDK_NOTIFY_ANCESTOR == aEvent->detail) || + (GDK_NOTIFY_VIRTUAL == aEvent->detail)); + +} + +/* static */ +int +is_parent_grab_leave(GdkEventCrossing *aEvent) +{ + return (GDK_CROSSING_GRAB == aEvent->mode) && + ((GDK_NOTIFY_ANCESTOR == aEvent->detail) || + (GDK_NOTIFY_VIRTUAL == aEvent->detail)); +} + #ifdef ACCESSIBILITY /** * void