public void dispatchEvent(XEvent xev) {
    if (eventLog.isLoggable(Level.FINEST)) eventLog.finest(xev.toString());
    int type = xev.get_type();

    if (isDisposed()) {
      return;
    }

    switch (type) {
      case VisibilityNotify:
        handleVisibilityEvent(xev);
        break;
      case ClientMessage:
        handleClientMessage(xev);
        break;
      case Expose:
      case GraphicsExpose:
        handleExposeEvent(xev);
        break;
      case ButtonPress:
      case ButtonRelease:
        handleButtonPressRelease(xev);
        break;

      case MotionNotify:
        handleMotionNotify(xev);
        break;
      case KeyPress:
        handleKeyPress(xev);
        break;
      case KeyRelease:
        handleKeyRelease(xev);
        break;
      case EnterNotify:
      case LeaveNotify:
        handleXCrossingEvent(xev);
        break;
      case ConfigureNotify:
        handleConfigureNotifyEvent(xev);
        break;
      case MapNotify:
        handleMapNotifyEvent(xev);
        break;
      case UnmapNotify:
        handleUnmapNotifyEvent(xev);
        break;
      case ReparentNotify:
        handleReparentNotifyEvent(xev);
        break;
      case PropertyNotify:
        handlePropertyNotify(xev);
        break;
      case DestroyNotify:
        handleDestroyNotify(xev);
        break;
      case CreateNotify:
        handleCreateNotify(xev);
        break;
    }
  }
Example #2
0
 void handleConfigureNotify(XEvent xev) {
   if (isXEmbedActive()) {
     XConfigureEvent ev = xev.get_xconfigure();
     if (xembedLog.isLoggable(PlatformLogger.FINER))
       xembedLog.finer("Bounds change on client: " + ev);
     if (xev.get_xany().get_window() == handle) {
       childResized();
     }
   }
 }
Example #3
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;
   }
 }
 public void handleCreateNotify(XEvent xev) {
   XAnyEvent xany = xev.get_xany();
   if (xany.get_window() != getWindow()) {
     synchronized (getStateLock()) {
       children.add(xany.get_window());
     }
   }
 }
 /** Activate automatic grab on first ButtonPress, deactivate on full mouse release */
 public void handleButtonPressRelease(XEvent xev) {
   XButtonEvent xbe = xev.get_xbutton();
   final int buttonState =
       xbe.get_state() & (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask);
   switch (xev.get_type()) {
     case ButtonPress:
       if (buttonState == 0) {
         XAwtState.setAutoGrabWindow(this);
       }
       break;
     case ButtonRelease:
       if (isFullRelease(buttonState, xbe.get_button())) {
         XAwtState.setAutoGrabWindow(null);
       }
       break;
   }
 }
 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)});
   }
 }
 /**
  * Dispatches event to the grab Window or event source window depending on whether the grab is
  * active and on the event type
  */
 static void dispatchToWindow(XEvent ev) {
   XBaseWindow target = XAwtState.getGrabWindow();
   if (target == null || !isGrabbedEvent(ev, target)) {
     target = XToolkit.windowToXWindow(ev.get_xany().get_window());
   }
   if (target != null && target.checkInitialised()) {
     target.dispatchEvent(ev);
   }
 }
 public void handleConfigureNotifyEvent(XEvent xev) {
   XConfigureEvent xe = xev.get_xconfigure();
   if (insLog.isLoggable(Level.FINER)) {
     insLog.log(Level.FINER, "Configure, {0}", new Object[] {String.valueOf(xe)});
   }
   x = xe.get_x();
   y = xe.get_y();
   width = xe.get_width();
   height = xe.get_height();
 }
Example #9
0
 public void dispatchEvent(XEvent xev) {
   int type = xev.get_type();
   switch (type) {
     case XConstants.PropertyNotify:
       handlePropertyNotify(xev);
       break;
     case XConstants.ConfigureNotify:
       handleConfigureNotify(xev);
       break;
     case XConstants.ClientMessage:
       handleClientMessage(xev);
       break;
   }
 }
 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());
     }
   }
 }
 static boolean isGrabbedEvent(XEvent ev, XBaseWindow target) {
   switch (ev.get_type()) {
     case ButtonPress:
     case ButtonRelease:
     case MotionNotify:
     case KeyPress:
     case KeyRelease:
       return true;
     case LeaveNotify:
     case EnterNotify:
       // We shouldn't dispatch this events to the grabbed components (see 6317481)
       // But this logic is important if the grabbed component is top-level (see realSync)
       return (target instanceof XWindowPeer);
     default:
       return false;
   }
 }
Example #12
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");
   }
 }
Example #13
0
 public void handleClientMessage(XEvent xev) {
   super.handleClientMessage(xev);
   XClientMessageEvent msg = xev.get_xclient();
   if (xembedLog.isLoggable(PlatformLogger.FINER))
     xembedLog.finer("Client message to embedder: " + msg);
   if (msg.get_message_type() == xembed.XEmbed.getAtom()) {
     if (xembedLog.isLoggable(PlatformLogger.FINE))
       xembedLog.fine(xembed.XEmbedMessageToString(msg));
   }
   if (isXEmbedActive()) {
     switch ((int) msg.get_data(1)) {
       case XEMBED_REQUEST_FOCUS:
         requestXEmbedFocus();
         break;
       case XEMBED_FOCUS_NEXT:
         focusNext();
         break;
       case XEMBED_FOCUS_PREV:
         focusPrev();
         break;
       case XEMBED_REGISTER_ACCELERATOR:
         registerAccelerator(msg.get_data(2), msg.get_data(3), msg.get_data(4));
         break;
       case XEMBED_UNREGISTER_ACCELERATOR:
         unregisterAccelerator(msg.get_data(2));
         break;
       case NON_STANDARD_XEMBED_GTK_GRAB_KEY:
         grabKey(msg.get_data(3), msg.get_data(4));
         break;
       case NON_STANDARD_XEMBED_GTK_UNGRAB_KEY:
         ungrabKey(msg.get_data(3), msg.get_data(4));
         break;
     }
   } else {
     xembedLog.finer("But XEmbed is not Active!");
   }
 }
 public void handleClientMessage(XEvent xev) {
   if (eventLog.isLoggable(Level.FINER)) {
     XClientMessageEvent msg = xev.get_xclient();
     eventLog.finer(msg.toString());
   }
 }
 public void handleReparentNotifyEvent(XEvent xev) {
   if (eventLog.isLoggable(Level.FINER)) {
     XReparentEvent msg = xev.get_xreparent();
     eventLog.finer(msg.toString());
   }
 }