This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gui][PATCH] remove window focus workaround


Hi,

My hack to work around a window manager bug:

2004-03-11  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(window_wm_protocols_filter): New function.
	...
	(create): Add filter that removes WM_TAKE_FOCUS client messages.
	...

was causing problems with WINDOW_CLOSING events, so I've reverted it.

Patch committed to java-gui-branch.

Tom

2004-05-26  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
	(window_wm_protocols_filter): Remove function.
	(create): Remove filter that removes WM_TAKE_FOCUS client
	messages.


Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c,v
retrieving revision 1.24.2.4
diff -u -r1.24.2.4 gnu_java_awt_peer_gtk_GtkWindowPeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c	29 Apr 2004 20:39:00 -0000	1.24.2.4
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c	26 May 2004 15:49:15 -0000
@@ -44,16 +44,9 @@
 #include <gdk/gdkx.h>
 #include <X11/Xatom.h>
 
-static int filter_added = 0;
-
-/* FIXME: this function is needed to work around double-activation
-   that occurs with metacity and GTK.  See
-   http://bugzilla.gnome.org/show_bug.cgi?id=140977 for details.  Owen
-   says filtering protocol messages will break future versions of
-   GTK. Once the bug is fixed, we'll remove this logic. */
-static GdkFilterReturn window_wm_protocols_filter (GdkXEvent *xev,
-                                                   GdkEvent  *event,
-                                                   gpointer   data);
+/* FIXME: we're currently seeing the double-activation that occurs
+   with metacity and GTK.  See
+   http://bugzilla.gnome.org/show_bug.cgi?id=140977 for details. */
 
 static void window_get_frame_extents (GtkWidget *window,
                                       int *top, int *left,
@@ -155,20 +148,6 @@
   insets[2] = bottom;
   insets[3] = right;
 
-  /* We must filter out WM_TAKE_FOCUS messages.  Otherwise we get two
-     focus in events when a window becomes active and two focus out
-     events when a window becomes inactive. */
-  if (!filter_added)
-    {
-      GdkAtom wm_protocols_atom =
-        gdk_x11_xatom_to_atom (gdk_x11_get_xatom_by_name ("WM_PROTOCOLS"));
-
-      gdk_add_client_message_filter (wm_protocols_atom,
-                                     window_wm_protocols_filter,
-                                     NULL);
-      filter_added = 1;
-    }
-
   gdk_threads_leave ();
 
   (*env)->ReleaseIntArrayElements (env, jinsets, insets, 0);
@@ -851,16 +830,3 @@
 
   return FALSE;
 }
-
-static GdkFilterReturn
-window_wm_protocols_filter (GdkXEvent *xev,
-                            GdkEvent  *event __attribute__((unused)),
-                            gpointer data __attribute__((unused)))
-{
-  XEvent *xevent = (XEvent *)xev;
-
-  if ((Atom) xevent->xclient.data.l[0] == gdk_x11_get_xatom_by_name ("WM_TAKE_FOCUS"))
-    return GDK_FILTER_REMOVE;
-
-  return GDK_FILTER_CONTINUE;
-}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]