Example #1
0
 boolean processXEmbedInfo() {
   long xembed_info_data = Native.allocateLongArray(2);
   try {
     if (!XEmbedInfo.getAtomData(handle, xembed_info_data, 2)) {
       // No more XEMBED_INFO? This is not XEmbed client!
       // Unfortunately this is the initial state of the most clients
       // FIXME: add 5-state processing
       // childDestroyed();
       xembedLog.finer("Unable to get XEMBED_INFO atom data");
       return false;
     }
     version = Native.getCard32(xembed_info_data, 0);
     flags = Native.getCard32(xembed_info_data, 1);
     boolean new_mapped = (flags & XEMBED_MAPPED) != 0;
     boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped;
     if (new_mapped != currently_mapped) {
       if (xembedLog.isLoggable(PlatformLogger.FINER))
         xembedLog.fine(
             "Mapping state of the client has changed, old state: "
                 + currently_mapped
                 + ", new state: "
                 + new_mapped);
       if (new_mapped) {
         XToolkit.awtLock();
         try {
           XlibWrapper.XMapWindow(XToolkit.getDisplay(), handle);
         } finally {
           XToolkit.awtUnlock();
         }
       } else {
         XToolkit.awtLock();
         try {
           XlibWrapper.XUnmapWindow(XToolkit.getDisplay(), handle);
         } finally {
           XToolkit.awtUnlock();
         }
       }
     } else {
       xembedLog.finer("Mapping state didn't change, mapped: " + currently_mapped);
     }
     return true;
   } finally {
     XlibWrapper.unsafe.freeMemory(xembed_info_data);
   }
 }
Example #2
0
 public void handlePropertyNotify(XEvent xev) {
   if (isXEmbedActive()) {
     XPropertyEvent ev = xev.get_xproperty();
     if (xembedLog.isLoggable(PlatformLogger.FINER))
       xembedLog.finer("Property change on client: " + ev);
     if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) {
       childResized();
     } else if (ev.get_atom() == XEmbedInfo.getAtom()) {
       processXEmbedInfo();
     } else if (ev.get_atom() == XDnDConstants.XA_XdndAware.getAtom()) {
       XDropTargetRegistry.getRegistry().unregisterXEmbedClient(getWindow(), xembed.handle);
       if (ev.get_state() == XConstants.PropertyNewValue) {
         XDropTargetRegistry.getRegistry().registerXEmbedClient(getWindow(), xembed.handle);
       }
     }
   } else {
     xembedLog.finer("XEmbed is not active");
   }
 }