예제 #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
  public void handleReparentNotifyEvent(XEvent xev) {
    XReparentEvent xe = xev.get_xreparent();
    if (insLog.isLoggable(Level.FINE)) insLog.fine(xe.toString());
    reparent_serial = xe.get_serial();
    XToolkit.awtLock();
    try {
      long root = XlibWrapper.RootWindow(XToolkit.getDisplay(), getScreenNumber());

      if (isEmbedded()) {
        setReparented(true);
        insets_corrected = true;
        return;
      }
      Component t = (Component) target;
      if (getDecorations() == winAttr.AWT_DECOR_NONE) {
        setReparented(true);
        insets_corrected = true;
        reshape(dimensions, SET_SIZE, false);
      } else if (xe.get_parent() == root) {
        configure_seen = false;
        insets_corrected = false;

        /*
         * We can be repareted to root for two reasons:
         *   . setVisible(false)
         *   . WM exited
         */
        if (isVisible()) {
            /* WM exited */
          /* Work around 4775545 */
          XWM.getWM().unshadeKludge(this);
          insLog.fine("- WM exited");
        } else {
          insLog.fine(" - reparent due to hide");
        }
      } else {
          /* reparented to WM frame, figure out our insets */
        setReparented(true);
        insets_corrected = false;

        // Check if we have insets provided by the WM
        Insets correctWM = getWMSetInsets(null);
        if (correctWM != null) {
          if (insLog.isLoggable(Level.FINER)) {
            insLog.log(
                Level.FINER, "wm-provided insets {0}", new Object[] {String.valueOf(correctWM)});
          }
          // If these insets are equal to our current insets - no actions are necessary
          Insets dimInsets = dimensions.getInsets();
          if (correctWM.equals(dimInsets)) {
            insLog.finer("Insets are the same as estimated - no additional reshapes necessary");
            no_reparent_artifacts = true;
            insets_corrected = true;
            applyGuessedInsets();
            return;
          }
        } else {
          correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());

          if (correctWM != null) {
            if (insLog.isLoggable(Level.FINER)) {
              insLog.log(Level.FINER, "correctWM {0}", new Object[] {String.valueOf(correctWM)});
            }
          } else {
            insLog.log(
                Level.FINER, "correctWM insets are not available, waiting for configureNotify");
          }
        }

        if (correctWM != null) {
          handleCorrectInsets(correctWM);
        }
      }
    } finally {
      XToolkit.awtUnlock();
    }
  }
예제 #3
0
 public void handleReparentNotifyEvent(XEvent xev) {
   if (eventLog.isLoggable(Level.FINER)) {
     XReparentEvent msg = xev.get_xreparent();
     eventLog.finer(msg.toString());
   }
 }