--- old/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java 2016-02-18 12:17:02.421527001 +0300 +++ new/src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java 2016-02-18 12:17:02.297527005 +0300 @@ -266,14 +266,17 @@ 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)) { @@ -345,7 +348,7 @@ // 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); } @@ -370,7 +373,7 @@ } } - if (correctWM != null) { + if (correctWM != null && !isNull(correctWM)) { handleCorrectInsets(correctWM); } } @@ -398,12 +401,20 @@ //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()) { @@ -716,7 +727,7 @@ 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)) { @@ -726,7 +737,7 @@ 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)