This fixes the problem where windows did not get notified of key events.
See the bug report.

2006-06-01  Lillian Angel  <[EMAIL PROTECTED]>

        PR 24458
        * java/awt/DefaultKeyboardFocusManager.java
        (dispatchEvent): Fixed to getFocusOwner, if that fails it tries
        to get the focused window.

Index: java/awt/DefaultKeyboardFocusManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/DefaultKeyboardFocusManager.java,v
retrieving revision 1.17
diff -u -r1.17 DefaultKeyboardFocusManager.java
--- java/awt/DefaultKeyboardFocusManager.java	5 Apr 2006 10:31:26 -0000	1.17
+++ java/awt/DefaultKeyboardFocusManager.java	2 Jun 2006 16:16:21 -0000
@@ -274,10 +274,12 @@
 
   public boolean dispatchKeyEvent (KeyEvent e)
   {
-    Component focusOwner = getGlobalPermanentFocusOwner ();
-
+    Component focusOwner = getFocusOwner();
+    if (focusOwner == null)
+      focusOwner = getFocusedWindow();
+    
     if (focusOwner != null)
-      redispatchEvent(focusOwner, e);
+      redispatchEvent(focusOwner, e);      
 
     // Loop through all registered KeyEventPostProcessors, giving
     // each a chance to process this event.
@@ -294,7 +296,7 @@
     // MenuShortcut.
     if (postProcessKeyEvent (e))
       return true;
-
+    
     // Always return true.
     return true;
   }

Reply via email to