コード例 #1
0
  protected void postInit(XCreateWindowParams params) {
    super.postInit(params);

    installActivateListener();
    installAcceleratorListener();
    installModalityListener();

    // XEmbed canvas should be non-traversable.
    // FIXME: Probably should be removed and enforced setting of it by the users
    target.setFocusTraversalKeysEnabled(false);
  }
コード例 #2
0
  public void dispose() {
    if (isXEmbedActive()) {
      detachChild();
    }
    deinstallActivateListener();
    deinstallModalityListener();
    deinstallAcceleratorListener();

    // BUG: Focus traversal doesn't become enabled after the one round of embedding
    // target.setFocusTraversalKeysEnabled(true);

    super.dispose();
  }
コード例 #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;
   }
 }
コード例 #4
0
  protected void preInit(XCreateWindowParams params) {
    super.preInit(params);

    params.put(
        EVENT_MASK,
        XConstants.KeyPressMask
            | XConstants.KeyReleaseMask
            | XConstants.FocusChangeMask
            | XConstants.ButtonPressMask
            | XConstants.ButtonReleaseMask
            | XConstants.EnterWindowMask
            | XConstants.LeaveWindowMask
            | XConstants.PointerMotionMask
            | XConstants.ButtonMotionMask
            | XConstants.ExposureMask
            | XConstants.StructureNotifyMask
            | XConstants.SubstructureNotifyMask);
  }
コード例 #5
0
 public void handleEvent(AWTEvent e) {
   super.handleEvent(e);
   if (isXEmbedActive()) {
     switch (e.getID()) {
       case FocusEvent.FOCUS_GAINED:
         canvasFocusGained((FocusEvent) e);
         break;
       case FocusEvent.FOCUS_LOST:
         canvasFocusLost((FocusEvent) e);
         break;
       case KeyEvent.KEY_PRESSED:
       case KeyEvent.KEY_RELEASED:
         if (!((InputEvent) e).isConsumed()) {
           forwardKeyEvent((KeyEvent) e);
         }
         break;
     }
   }
 }
コード例 #6
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!");
   }
 }