This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[PATCH] Remove spurious GDK_ENTER_NOTIFY events
- From: Fernando Nasser <fnasser at redhat dot com>
- To: GCJ Patches <java-patches at gcc dot gnu dot org>
- Date: Fri, 16 Jan 2004 16:54:13 -0500
- Subject: [PATCH] Remove spurious GDK_ENTER_NOTIFY events
- Organization: Red Hat , Inc. - Toronto
David Jee detected that we were getting an expurious mouse enter event when
clicking a mouse button. Him and Tom Fitzsimmons helped me track it down to a
missing if statement in the event handling code -- we had it for LEAVE but not
for ENTER.
Here is the patch:
2004-01-16 Fernando Nasser <fnasser@redhat.com>
* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c (pre_event_handler):
Discard GDK_ENTER_NOTIFY related to ungrabs.
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,v
retrieving revision 1.17
diff -u -p -r1.17 gnu_java_awt_peer_gtk_GtkEvents.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c 13 Jan 2004 20:54:46 -0000 1.17
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c 16 Jan 2004 21:46:43 -0000
@@ -960,16 +960,21 @@ pre_event_handler (GtkWidget *widget, Gd
}
break;
case GDK_ENTER_NOTIFY:
- (*gdk_env)->CallVoidMethod (gdk_env, peer, postMouseEventID,
- AWT_MOUSE_ENTERED,
- (jlong)event->crossing.time,
- state_to_awt_mods (event->crossing.state),
- (jint)event->crossing.x,
- (jint)event->crossing.y,
- 0,
- JNI_FALSE);
+ /* We are not interested in enter events that are due to
+ grab/ungrab and not to actually crossing boundaries */
+ if (event->crossing.mode == GDK_CROSSING_NORMAL)
+ (*gdk_env)->CallVoidMethod (gdk_env, peer, postMouseEventID,
+ AWT_MOUSE_ENTERED,
+ (jlong)event->crossing.time,
+ state_to_awt_mods (event->crossing.state),
+ (jint)event->crossing.x,
+ (jint)event->crossing.y,
+ 0,
+ JNI_FALSE);
break;
case GDK_LEAVE_NOTIFY:
+ /* We are not interested in leave events that are due to
+ grab/ungrab and not to actually crossing boundaries */
if (event->crossing.mode == GDK_CROSSING_NORMAL)
(*gdk_env)->CallVoidMethod (gdk_env, peer,
postMouseEventID,