public void addClient() { client = new Canvas() { public void paint(Graphics g) { super.paint(g); } }; client.setBackground(new Color(30, 220, 40)); clientCont.add(client); clientCont.validate(); final ComponentAccessor acc = AWTAccessor.getComponentAccessor(); WindowIDProvider pid = (WindowIDProvider) acc.getPeer(client); log.fine("Added XEmbed server(Canvas) with X window ID " + pid.getWindow()); Rectangle toFocusBounds = toFocus.getBounds(); toFocusBounds.setLocation(toFocus.getLocationOnScreen()); f.validate(); // KDE doesn't accept clicks on title as activation - click below title Rectangle fbounds = f.getBounds(); fbounds.y += f.getInsets().top; fbounds.height -= f.getInsets().top; Process proc = startClient( new Rectangle[] { fbounds, dummy.getBounds(), toFocusBounds, new Rectangle(b_modal.getLocationOnScreen(), b_modal.getSize()), new Rectangle(10, 130, 20, 20) }, pid.getWindow()); new ClientWatcher(client, proc, clientCont).start(); }
/** * 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)); }