7161575: [macosx] On MacOSX port java.awt.Toolkit.is/setDynamicLayout() are not consistent
authorserb
Mon, 06 May 2013 16:23:36 +0400
changeset 17410 c9c726c5ce7e
parent 17152 0467e4708200
child 17411 6a6136a94ebb
7161575: [macosx] On MacOSX port java.awt.Toolkit.is/setDynamicLayout() are not consistent Reviewed-by: anthony, art
jdk/src/macosx/classes/sun/lwawt/LWToolkit.java
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Wed May 01 09:20:08 2013 -0700
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Mon May 06 16:23:36 2013 +0400
@@ -53,7 +53,12 @@
     private Clipboard clipboard;
     private MouseInfoPeer mouseInfoPeer;
 
-    public LWToolkit() {
+    /**
+     * Dynamic Layout Resize client code setting.
+     */
+    private volatile boolean dynamicLayoutSetting = true;
+
+    protected LWToolkit() {
     }
 
     /*
@@ -561,4 +566,37 @@
             ((LWWindowPeer)w.getPeer()).ungrab(false);
         }
     }
+
+    @Override
+    protected final Object lazilyLoadDesktopProperty(final String name) {
+        if (name.equals("awt.dynamicLayoutSupported")) {
+            return isDynamicLayoutSupported();
+        }
+        return super.lazilyLoadDesktopProperty(name);
+    }
+
+    @Override
+    public final void setDynamicLayout(final boolean dynamic) {
+        dynamicLayoutSetting = dynamic;
+    }
+
+    @Override
+    protected final boolean isDynamicLayoutSet() {
+        return dynamicLayoutSetting;
+    }
+
+    @Override
+    public final boolean isDynamicLayoutActive() {
+        // "Live resizing" is active by default and user's data is ignored.
+        return isDynamicLayoutSupported();
+    }
+
+    /**
+     * Returns true if dynamic layout of Containers on resize is supported by
+     * the underlying operating system and/or window manager.
+     */
+    protected final boolean isDynamicLayoutSupported() {
+        // "Live resizing" is supported by default.
+        return true;
+    }
 }