public void setVisible(boolean vis) { if (log.isLoggable(Level.FINER)) { log.log( Level.FINER, "Setting {0} to visible {1}", new Object[] {String.valueOf(this), Boolean.valueOf(vis)}); } if (vis && !isVisible()) { XWM.setShellDecor(this); super.setVisible(vis); if (winAttr.isResizable) { // Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. // We need to update frame's minimum size, not to reset it XWM.removeSizeHints(this, XlibWrapper.PMaxSize); updateMinimumSize(); } } else { super.setVisible(vis); } }
private void updateMinSizeHints() { if (isResizable()) { Dimension minimumSize = getTargetMinimumSize(); if (minimumSize != null) { Insets insets = getRealInsets(); int minWidth = minimumSize.width - insets.left - insets.right; int minHeight = minimumSize.height - insets.top - insets.bottom; if (minWidth < 0) minWidth = 0; if (minHeight < 0) minHeight = 0; setSizeHints( XlibWrapper.PMinSize | (isLocationByPlatform() ? 0 : (XlibWrapper.PPosition | XlibWrapper.USPosition)), getX(), getY(), minWidth, minHeight); if (isVisible()) { Rectangle bounds = getShellBounds(); int nw = (bounds.width < minWidth) ? minWidth : bounds.width; int nh = (bounds.height < minHeight) ? minHeight : bounds.height; if (nw != bounds.width || nh != bounds.height) { setShellSize(new Rectangle(0, 0, nw, nh)); } } } else { boolean isMinSizeSet = isMinSizeSet(); XWM.removeSizeHints(this, XlibWrapper.PMinSize); /* Some WMs need remap to redecorate the window */ if (isMinSizeSet && isShowing() && XWM.needRemap(this)) { /* * Do the re/mapping at the Xlib level. Since we essentially * work around a WM bug we don't want this hack to be exposed * to Intrinsics (i.e. don't mess with grabs, callbacks etc). */ xSetVisible(false); XToolkit.XSync(); xSetVisible(true); } } } }