Пример #1
0
 public void dispatchEvent(XEvent ev) {
   super.dispatchEvent(ev);
   switch (ev.get_type()) {
     case XConstants.CreateNotify:
       XCreateWindowEvent cr = ev.get_xcreatewindow();
       if (xembedLog.isLoggable(PlatformLogger.FINEST)) {
         xembedLog.finest("Message on embedder: " + cr);
       }
       if (xembedLog.isLoggable(PlatformLogger.FINER)) {
         xembedLog.finer(
             "Create notify for parent "
                 + Long.toHexString(cr.get_parent())
                 + ", window "
                 + Long.toHexString(cr.get_window()));
       }
       embedChild(cr.get_window());
       break;
     case XConstants.DestroyNotify:
       XDestroyWindowEvent dn = ev.get_xdestroywindow();
       if (xembedLog.isLoggable(PlatformLogger.FINEST)) {
         xembedLog.finest("Message on embedder: " + dn);
       }
       if (xembedLog.isLoggable(PlatformLogger.FINER)) {
         xembedLog.finer("Destroy notify for parent: " + dn);
       }
       childDestroyed();
       break;
     case XConstants.ReparentNotify:
       XReparentEvent rep = ev.get_xreparent();
       if (xembedLog.isLoggable(PlatformLogger.FINEST)) {
         xembedLog.finest("Message on embedder: " + rep);
       }
       if (xembedLog.isLoggable(PlatformLogger.FINER)) {
         xembedLog.finer(
             "Reparent notify for parent "
                 + Long.toHexString(rep.get_parent())
                 + ", window "
                 + Long.toHexString(rep.get_window())
                 + ", event "
                 + Long.toHexString(rep.get_event()));
       }
       if (rep.get_parent() == getWindow()) {
         // Reparented into us - embed it
         embedChild(rep.get_window());
       } else {
         // Reparented out of us - detach it
         childDestroyed();
       }
       break;
   }
 }
Пример #2
0
 void endDispatching() {
   xembedLog.fine("End dispatching for " + Long.toHexString(xembed.handle));
   XToolkit.awtLock();
   try {
     XDropTargetRegistry.getRegistry().unregisterXEmbedClient(getWindow(), xembed.handle);
     // We can't deselect input since someone else might be interested in it
     XToolkit.removeEventDispatcher(xembed.handle, xembed);
   } finally {
     XToolkit.awtUnlock();
   }
 }
Пример #3
0
  void initDispatching() {
    if (xembedLog.isLoggable(PlatformLogger.FINE))
      xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle));
    XToolkit.awtLock();
    try {
      XToolkit.addEventDispatcher(xembed.handle, xembed);
      XlibWrapper.XSelectInput(
          XToolkit.getDisplay(),
          xembed.handle,
          XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);

      XDropTargetRegistry.getRegistry().registerXEmbedClient(getWindow(), xembed.handle);
    } finally {
      XToolkit.awtUnlock();
    }
    xembed.processXEmbedInfo();

    notifyChildEmbedded();
  }
Пример #4
0
 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;
 }
Пример #5
0
 void childDestroyed() {
   xembedLog.fine("Child " + Long.toHexString(xembed.handle) + " has self-destroyed.");
   endDispatching();
   xembed.handle = 0;
 }