/** * Verifies that all required parameters are set. If not, sets them to default values. Verifies * values of critical parameters, adjust their values when needed. * * @throws IllegalArgumentException if params is null */ protected void checkParams(XCreateWindowParams params) { if (params == null) { throw new IllegalArgumentException("Window creation parameters are null"); } params.putIfNull(PARENT_WINDOW, Long.valueOf(XToolkit.getDefaultRootWindow())); params.putIfNull(BOUNDS, new Rectangle(DEF_LOCATION, DEF_LOCATION, MIN_SIZE, MIN_SIZE)); params.putIfNull(DEPTH, Integer.valueOf((int) XlibWrapper.CopyFromParent)); params.putIfNull(VISUAL, Long.valueOf(XlibWrapper.CopyFromParent)); params.putIfNull(VISUAL_CLASS, Integer.valueOf((int) XlibWrapper.InputOnly)); params.putIfNull(VALUE_MASK, Long.valueOf(XlibWrapper.CWEventMask)); Rectangle bounds = (Rectangle) params.get(BOUNDS); bounds.width = Math.max(MIN_SIZE, bounds.width); bounds.height = Math.max(MIN_SIZE, bounds.height); Long eventMaskObj = (Long) params.get(EVENT_MASK); long eventMask = eventMaskObj != null ? eventMaskObj.longValue() : 0; // We use our own synthetic grab see XAwtState.getGrabWindow() // (see X vol. 1, 8.3.3.2) eventMask |= PropertyChangeMask | OwnerGrabButtonMask; params.put(EVENT_MASK, Long.valueOf(eventMask)); }
void detachChild() { if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle)); /** * XEmbed specification: "The embedder can unmap the client and reparent the client window to * the root window. If the client receives an ReparentNotify event, it should check the parent * field of the XReparentEvent structure. If this is the root window of the window's screen, * then the protocol is finished and there is no further interaction. If it is a window other * than the root window, then the protocol continues with the new parent acting as the embedder * window." */ XToolkit.awtLock(); try { XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), xembed.handle); XlibWrapper.XReparentWindow( XToolkit.getDisplay(), xembed.handle, XToolkit.getDefaultRootWindow(), 0, 0); } finally { XToolkit.awtUnlock(); } endDispatching(); xembed.handle = 0; }
public int getAbsoluteY() { Point absoluteLoc = XlibUtil.translateCoordinates( getWindow(), XToolkit.getDefaultRootWindow(), new Point(0, 0)); return absoluteLoc != null ? absoluteLoc.y : 0; }