changeset 4898:df49f9ddd89f

7145827: [macosx] JCK failure in b11: FocusableWindow3 Reviewed-by: art
author ant
date Fri, 16 Mar 2012 13:58:43 +0300
parents 55126bbf3cc9
children e1074508e049
files src/macosx/classes/sun/lwawt/LWWindowPeer.java
diffstat 1 files changed, 15 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Mar 16 11:39:31 2012 +0400
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Fri Mar 16 13:58:43 2012 +0300
@@ -101,8 +101,6 @@
     // events between MOUSE_PRESSED and MOUSE_RELEASED for particular button
     private static int mouseClickButtons = 0;
 
-    private volatile boolean cachedFocusableWindow;
-
     private volatile boolean isOpaque = true;
 
     private static final Font DEFAULT_FONT = new Font("Lucida Grande", Font.PLAIN, 13);
@@ -172,8 +170,6 @@
         setAlwaysOnTop(getTarget().isAlwaysOnTop());
         updateMinimumSize();
 
-        cachedFocusableWindow = getTarget().isFocusableWindow();
-
         setOpacity(getTarget().getOpacity());
         setOpaque(getTarget().isOpaque());
 
@@ -245,7 +241,6 @@
                         getInstance(getAppContext());
 
                     if (visible) {
-                        updateFocusableWindowState();
                         changeFocusedWindow(true, true);
 
                     // Focus the owner in case this window is focused.
@@ -418,7 +413,6 @@
 
     @Override
     public void updateFocusableWindowState() {
-        cachedFocusableWindow = getTarget().isFocusableWindow();
         platformWindow.updateFocusableWindowState();
     }
 
@@ -1142,7 +1136,19 @@
     private boolean focusAllowedFor() {
         Window window = getTarget();
         // TODO: check if modal blocked
-        return window.isVisible() && window.isEnabled() && window.isFocusableWindow();
+        return window.isVisible() && window.isEnabled() && isFocusableWindow();
+    }
+
+    private boolean isFocusableWindow() {
+        boolean focusable = getTarget().isFocusableWindow();
+        if (isSimpleWindow()) {
+            LWWindowPeer ownerPeer = getOwnerFrameDialog(this);
+            if (ownerPeer == null) {
+                return false;
+            }
+            return focusable && ownerPeer.getTarget().isFocusableWindow();
+        }
+        return focusable;
     }
 
     public boolean isSimpleWindow() {
@@ -1162,8 +1168,8 @@
             skipNextFocusChange = false;
             return;
         }
-
-        if (!cachedFocusableWindow) {
+        if (!isFocusableWindow() && becomesFocused) {
+            focusLog.fine("the window is not focusable");
             return;
         }
         if (becomesFocused) {