8006790: Improve checking for windows
authormalenkov
Tue, 05 Feb 2013 20:07:54 +0400
changeset 16892 24a521782b42
parent 16891 91e99bed64ae
child 16893 5bed2c2c97dc
8006790: Improve checking for windows Reviewed-by: art, mschoene
jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java
jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java
jdk/src/share/classes/java/awt/Window.java
jdk/src/share/classes/java/awt/peer/WindowPeer.java
jdk/src/share/classes/sun/awt/EmbeddedFrame.java
jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -170,7 +170,7 @@
             setTitle(((Dialog) getTarget()).getTitle());
         }
 
-        setAlwaysOnTop(getTarget().isAlwaysOnTop());
+        updateAlwaysOnTopState();
         updateMinimumSize();
 
         final Shape shape = getTarget().getShape();
@@ -357,8 +357,8 @@
     }
 
     @Override
-    public void setAlwaysOnTop(boolean value) {
-        platformWindow.setAlwaysOnTop(value);
+    public void updateAlwaysOnTopState() {
+        platformWindow.setAlwaysOnTop(getTarget().isAlwaysOnTop());
     }
 
     @Override
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CFileDialog.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -180,7 +180,7 @@
     }
 
     @Override
-    public void setAlwaysOnTop(boolean alwaysOnTop) {
+    public void updateAlwaysOnTopState() {
     }
 
     @Override
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterDialogPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -87,7 +87,7 @@
     }
 
     // 1.6 peer method
-    public void setAlwaysOnTop(boolean value) {
+    public void updateAlwaysOnTopState() {
         // no-op, since we just show the native print dialog
     }
 
--- a/jdk/src/share/classes/java/awt/Window.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/share/classes/java/awt/Window.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2234,7 +2234,7 @@
                 WindowPeer peer = (WindowPeer)this.peer;
                 synchronized(getTreeLock()) {
                     if (peer != null) {
-                        peer.setAlwaysOnTop(alwaysOnTop);
+                        peer.updateAlwaysOnTopState();
                     }
                 }
             }
--- a/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/share/classes/java/awt/peer/WindowPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,15 +53,14 @@
     void toBack();
 
     /**
-     * Sets if the window should always stay on top of all other windows or
-     * not.
+     * Updates the window's always-on-top state.
+     * Sets if the window should always stay
+     * on top of all other windows or not.
      *
-     * @param alwaysOnTop if the window should always stay on top of all other
-     *        windows or not
-     *
+     * @see Window#getAlwaysOnTop()
      * @see Window#setAlwaysOnTop(boolean)
      */
-    void setAlwaysOnTop(boolean alwaysOnTop);
+    void updateAlwaysOnTopState();
 
     /**
      * Updates the window's focusable state.
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -542,7 +542,7 @@
         public void toBack() {}
         public void updateFocusableWindowState() {}
         public void updateAlwaysOnTop() {}
-        public void setAlwaysOnTop(boolean alwaysOnTop) {}
+        public void updateAlwaysOnTopState() {}
         public Component getGlobalHeavyweightFocusOwner() { return null; }
         public void setBoundsPrivate(int x, int y, int width, int height) {
             setBounds(x, y, width, height, SET_BOUNDS);
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -993,8 +993,8 @@
                              XLayerProtocol.LAYER_NORMAL);
     }
 
-    public void setAlwaysOnTop(boolean alwaysOnTop) {
-        this.alwaysOnTop = alwaysOnTop;
+    public void updateAlwaysOnTopState() {
+        this.alwaysOnTop = ((Window) this.target).isAlwaysOnTop();
         updateAlwaysOnTop();
     }
 
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -237,7 +237,7 @@
 
     // unused methods.  Overridden to disable this functionality as
     // it requires HWND which is not available for FileDialog
-    public void setAlwaysOnTop(boolean value) {}
+    public void updateAlwaysOnTopState() {}
     public void setDirectory(String dir) {}
     public void setFile(String file) {}
     public void setTitle(String title) {}
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -117,7 +117,7 @@
     // unused methods.  Overridden to disable this functionality as
     // it requires HWND which is not available for FileDialog
     void initialize() {}
-    public void setAlwaysOnTop(boolean b) {}
+    public void updateAlwaysOnTopState() {}
     public void setResizable(boolean resizable) {}
     public void hide() {}
     public void enable() {}
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Thu Mar 07 10:02:20 2013 -0800
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue Feb 05 20:07:54 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -132,6 +132,10 @@
         }
     }
 
+    public void updateAlwaysOnTopState() {
+        setAlwaysOnTop(((Window)target).isAlwaysOnTop());
+    }
+
     public void updateFocusableWindowState() {
         setFocusableWindow(((Window)target).isFocusableWindow());
     }