< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java

Print this page

        

@@ -264,18 +264,21 @@
     private Insets getWMSetInsets(XAtom changedAtom) {
         if (isEmbedded()) {
             return null;
         }
 
-        if (wm_set_insets != null) {
+        if (wm_set_insets != null && !isNull(wm_set_insets)) {
             return wm_set_insets;
         }
 
         if (changedAtom == null) {
             wm_set_insets = XWM.getInsetsFromExtents(getWindow());
         } else {
-            wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
+            Insets insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
+            if (insets != null && !isNull(insets)) {
+                wm_set_insets = insets;
+            }
         }
 
         if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
             insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets);
         }

@@ -343,11 +346,11 @@
                 setReparented(true);
                 insets_corrected = false;
 
                 // Check if we have insets provided by the WM
                 Insets correctWM = getWMSetInsets(null);
-                if (correctWM != null) {
+                if (correctWM != null && !isNull(correctWM)) {
                     if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
                         insLog.finer("wm-provided insets {0}", correctWM);
                     }
                     // If these insets are equal to our current insets - no actions are necessary
                     Insets dimInsets = dimensions.getInsets();

@@ -368,11 +371,11 @@
                             insLog.finer("correctWM insets are not available, waiting for configureNotify");
                         }
                     }
                 }
 
-                if (correctWM != null) {
+                if (correctWM != null && !isNull(correctWM)) {
                     handleCorrectInsets(correctWM);
                 }
             }
         } finally {
             XToolkit.awtUnlock();

@@ -396,16 +399,24 @@
 
                 //Fix for 6318109: PIT: Min Size is not honored properly when a
                 //smaller size is specified in setSize(), XToolkit
                 //update minimum size hints
                 updateMinSizeHints();
+            } else {
+                return;
             }
             if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
                 insLog.finer("Dimensions before reparent: " + dimensions);
             }
 
-            dimensions.setInsets(getRealInsets());
+            dimensions.setInsets(correctWM);
+            if (dimensions.isClientSizeSet()) {
+                Dimension cs = dimensions.getClientSize();
+                dimensions.setClientSize(
+                        cs.width - correction.left - correction.right,
+                        cs.height - correction.top - correction.bottom);
+            }
             insets_corrected = true;
 
             if (isMaximized()) {
                 return;
             }

@@ -714,21 +725,21 @@
                 && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
             insLog.fine("- visible but not reparented, skipping");
             return;
         }
         //Last chance to correct insets
-        if (!insets_corrected && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
+        if (getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
             long parent = XlibUtil.getParentWindow(window);
             Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null;
             if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
                 if (correctWM != null) {
                     insLog.finer("Configure notify - insets : " + correctWM);
                 } else {
                     insLog.finer("Configure notify - insets are still not available");
                 }
             }
-            if (correctWM != null) {
+            if (correctWM != null && !isNull(correctWM)) {
                 handleCorrectInsets(correctWM);
             } else {
                 //Only one attempt to correct insets is made (to lower risk)
                 //if insets are still not available we simply set the flag
                 insets_corrected = true;
< prev index next >