public void preInit(XCreateWindowParams params) {
   super.preInit(params);
   strokes = new LinkedList<AWTKeyStroke>();
   if (supportsXEmbed()) {
     embedder = new XEmbedClientHelper();
   }
 }
 protected void requestInitialFocus() {
   if (embedder != null && supportsXEmbed()) {
     embedder.requestFocus();
   } else {
     super.requestInitialFocus();
   }
 }
 @Override
 public void dispose() {
   if (embedder != null) {
     // uninstall X11 event dispatcher
     embedder.setClient(null);
   }
   super.dispose();
 }
 void postInit(XCreateWindowParams params) {
   super.postInit(params);
   if (embedder != null) {
     // install X11 event dispatcher
     embedder.setClient(this);
     // reparent to XEmbed server
     embedder.install();
   } else if (getParentWindowHandle() != 0) {
     XToolkit.awtLock();
     try {
       XlibWrapper.XReparentWindow(
           XToolkit.getDisplay(), getWindow(), getParentWindowHandle(), 0, 0);
     } finally {
       XToolkit.awtUnlock();
     }
   }
 }
  // override XWindowPeer's method to let the embedded frame to block
  // the containing window
  public void setModalBlocked(Dialog blocker, boolean blocked) {
    super.setModalBlocked(blocker, blocked);

    EmbeddedFrame frame = (EmbeddedFrame) target;
    frame.notifyModalBlocked(blocker, blocked);
  }