public Dimension getMinimumSize() { if (isXEmbedActive()) { XToolkit.awtLock(); try { long p_hints = XlibWrapper.XAllocSizeHints(); XSizeHints hints = new XSizeHints(p_hints); XlibWrapper.XGetWMNormalHints( XToolkit.getDisplay(), xembed.handle, p_hints, XlibWrapper.larg1); Dimension res = new Dimension(hints.get_min_width(), hints.get_min_height()); XlibWrapper.XFree(p_hints); return res; } finally { XToolkit.awtUnlock(); } } else { return super.getMinimumSize(); } }
public boolean isMinSizeSet() { XSizeHints hints = getHints(); long flags = hints.get_flags(); return ((flags & XlibWrapper.PMinSize) == XlibWrapper.PMinSize); }
public void setSizeHints(long flags, int x, int y, int width, int height) { if (insLog.isLoggable(Level.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags)); XToolkit.awtLock(); try { XSizeHints hints = getHints(); // Note: if PPosition is not set in flags this means that // we want to reset PPosition in hints. This is necessary // for locationByPlatform functionality if ((flags & XlibWrapper.PPosition) != 0) { hints.set_x(x); hints.set_y(y); } if ((flags & XlibWrapper.PSize) != 0) { hints.set_width(width); hints.set_height(height); } else if ((hints.get_flags() & XlibWrapper.PSize) != 0) { flags |= XlibWrapper.PSize; } if ((flags & XlibWrapper.PMinSize) != 0) { hints.set_min_width(width); hints.set_min_height(height); } else if ((hints.get_flags() & XlibWrapper.PMinSize) != 0) { flags |= XlibWrapper.PMinSize; // Fix for 4320050: Minimum size for java.awt.Frame is not being enforced. // We don't need to reset minimum size if it's already set } if ((flags & XlibWrapper.PMaxSize) != 0) { if (maxBounds != null) { if (maxBounds.width != Integer.MAX_VALUE) { hints.set_max_width(maxBounds.width); } else { hints.set_max_width(XToolkit.getDefaultScreenWidth()); } if (maxBounds.height != Integer.MAX_VALUE) { hints.set_max_height(maxBounds.height); } else { hints.set_max_height(XToolkit.getDefaultScreenHeight()); } } else { hints.set_max_width(width); hints.set_max_height(height); } } else if ((hints.get_flags() & XlibWrapper.PMaxSize) != 0) { flags |= XlibWrapper.PMaxSize; if (maxBounds != null) { if (maxBounds.width != Integer.MAX_VALUE) { hints.set_max_width(maxBounds.width); } else { hints.set_max_width(XToolkit.getDefaultScreenWidth()); } if (maxBounds.height != Integer.MAX_VALUE) { hints.set_max_height(maxBounds.height); } else { hints.set_max_height(XToolkit.getDefaultScreenHeight()); } } else { // Leave intact } } flags |= XlibWrapper.PWinGravity; hints.set_flags(flags); hints.set_win_gravity((int) XlibWrapper.NorthWestGravity); if (insLog.isLoggable(Level.FINER)) insLog.finer( "Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + ", values " + hints); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData); } finally { XToolkit.awtUnlock(); } }