classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] FYI DefaultKeyboardFocusManager from libgcj


From: Mark Wielaard
Subject: [cp-patches] FYI DefaultKeyboardFocusManager from libgcj
Date: Sun, 07 Nov 2004 01:38:55 +0100

Hi,

This adds the following fixlet from libgcj gui branch.

2004-11-06  Thomas Fitzsimmons  <address@hidden>

       * java/awt/DefaultKeyboardFocusManager.java (dispatchEvent):
       Track Window focus owner on FOCUS_GAINED events.

Committed,

Mark


Index: java/awt/DefaultKeyboardFocusManager.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/java/awt/DefaultKeyboardFocusManager.java,v
retrieving revision 1.10
diff -u -r1.10 DefaultKeyboardFocusManager.java
--- java/awt/DefaultKeyboardFocusManager.java   27 Sep 2004 15:11:46 -0000      
1.10
+++ java/awt/DefaultKeyboardFocusManager.java   7 Nov 2004 00:41:02 -0000
@@ -171,18 +171,15 @@
 
         if (e.id == FocusEvent.FOCUS_GAINED)
           {
-            if (((FocusEvent) e).isTemporary ())
-              setGlobalFocusOwner (target);
-            else
-              setGlobalPermanentFocusOwner (target);
-          }
-        else if (e.id == FocusEvent.FOCUS_LOST)
-          {
-            // We need to set the window's focus owner here; we can't
-            // set it when the window loses focus because by that time
-            // the previous focus owner has already lost focus
-            // (FOCUS_LOST events are delivered before
-            // WINDOW_LOST_FOCUS events).
+            if (! (target instanceof Window))
+              {
+                if (((FocusEvent) e).isTemporary ())
+                  setGlobalFocusOwner (target);
+                else
+                  setGlobalPermanentFocusOwner (target);
+              }
+
+            // Keep track of this window's focus owner.
 
             // Find the target Component's top-level ancestor.
             Container parent = target.getParent ();
@@ -195,9 +192,12 @@
               (Window) target : (Window) parent;
 
             Component focusOwner = getFocusOwner ();
-            if (focusOwner != null)
+            if (focusOwner != null
+                && ! (focusOwner instanceof Window))
               toplevel.setFocusOwner (focusOwner);
-
+          }
+        else if (e.id == FocusEvent.FOCUS_LOST)
+          {
             if (((FocusEvent) e).isTemporary ())
               setGlobalFocusOwner (null);
             else

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]