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; } }