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] give GtkPanelPeer the GTK focus


Hi,

A GtkPanelPeer should grab the GTK focus when it obtains the AWT focus. 
Otherwise, applets embedded in web pages cannot gain the keyboard
focus.  I committed this patch to java-gui-branch.

Tom

2004-07-12  Thomas Fitzsimmons  <fitzsim@redhat.com>

	* java/awt/Component.java (requestFocus()): Don't handle Panels
	specially.
	(requestFocus(boolean)): Likewise.
	(requestFocusInWindow(boolean)): Likewise.
	* jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (create):
	Set GTK_CAN_FOCUS flag.

Index: java/awt/Component.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/awt/Component.java,v
retrieving revision 1.37.2.15
diff -u -r1.37.2.15 Component.java
--- java/awt/Component.java	12 Jul 2004 03:26:58 -0000	1.37.2.15
+++ java/awt/Component.java	12 Jul 2004 05:27:15 -0000
@@ -3697,8 +3697,7 @@
             Window toplevel = (Window) parent;
             if (toplevel.isFocusableWindow ())
               {
-                if (peer != null
-                    && !(this instanceof Panel))
+                if (peer != null)
                   // This call will cause a FOCUS_GAINED event to be
                   // posted to the system event queue if the native
                   // windowing system grants the focus request.
@@ -3784,8 +3783,7 @@
             Window toplevel = (Window) parent;
             if (toplevel.isFocusableWindow ())
               {
-                if (peer != null
-                    && !(this instanceof Panel))
+                if (peer != null)
                   // This call will cause a FOCUS_GAINED event to be
                   // posted to the system event queue if the native
                   // windowing system grants the focus request.
@@ -3906,7 +3904,6 @@
                 if (focusedWindow == toplevel)
                   {
                     if (peer != null
-                        && !(this instanceof Panel)
                         && !(this instanceof Window))
                       // This call will cause a FOCUS_GAINED event to be
                       // posted to the system event queue if the native
Index: jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
===================================================================
RCS file: /cvs/gcc/gcc/libjava/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c,v
retrieving revision 1.4.8.1
diff -u -r1.4.8.1 gnu_java_awt_peer_gtk_GtkPanelPeer.c
--- jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c	9 Apr 2004 22:29:02 -0000	1.4.8.1
+++ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c	12 Jul 2004 05:27:20 -0000
@@ -53,6 +53,8 @@
   
   widget = gtk_layout_new (NULL, NULL);
 
+  GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
+
   gdk_threads_leave ();
 
   NSA_SET_PTR (env, obj, widget);

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