public void handlePropertyNotify(XEvent xev) {
   XPropertyEvent msg = xev.get_xproperty();
   if (XPropertyCache.isCachingSupported()) {
     XPropertyCache.clearCache(window, XAtom.get(msg.get_atom()));
   }
   if (eventLog.isLoggable(Level.FINER)) {
     eventLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(msg)});
   }
 }
 public void handleDestroyNotify(XEvent xev) {
   XAnyEvent xany = xev.get_xany();
   if (xany.get_window() == getWindow()) {
     XToolkit.removeFromWinMap(getWindow(), this);
     if (XPropertyCache.isCachingSupported()) {
       XPropertyCache.clearCache(getWindow());
     }
   }
   if (xany.get_window() != getWindow()) {
     synchronized (getStateLock()) {
       children.remove(xany.get_window());
     }
   }
 }
  void destroy() {
    XToolkit.awtLock();
    try {
      if (hints != null) {
        XlibWrapper.XFree(hints.pData);
        hints = null;
      }
      XToolkit.removeFromWinMap(getWindow(), this);
      XlibWrapper.XDestroyWindow(XToolkit.getDisplay(), getWindow());
      if (XPropertyCache.isCachingSupported()) {
        XPropertyCache.clearCache(window);
      }
      window = -1;
      if (!isDisposed()) {
        setDisposed(true);
      }

      XAwtState
          .getGrabWindow(); // Magic - getGrabWindow clear state if grabbing window is disposed of.
    } finally {
      XToolkit.awtUnlock();
    }
  }