Exemplo n.º 1
0
  /**
   * Brute force method to return the NEWT event modifiers equivalent to the specified AWT event
   * extended modifiers.
   *
   * @param awtExtendedModifiers The AWT extended modifiers.
   * @return The equivalent NEWT modifiers.
   */
  private int _getNewtModifiersForAwtExtendedModifiers(int awtExtendedModifiers) {

    int mask = 0;

    if ((awtExtendedModifiers & java.awt.event.InputEvent.SHIFT_DOWN_MASK) != 0) {
      mask |= com.jogamp.newt.event.InputEvent.SHIFT_MASK;
    }

    if ((awtExtendedModifiers & java.awt.event.InputEvent.CTRL_DOWN_MASK) != 0) {
      mask |= com.jogamp.newt.event.InputEvent.CTRL_MASK;
    }

    if ((awtExtendedModifiers & java.awt.event.InputEvent.META_DOWN_MASK) != 0) {
      mask |= com.jogamp.newt.event.InputEvent.META_MASK;
    }

    if ((awtExtendedModifiers & java.awt.event.InputEvent.ALT_DOWN_MASK) != 0) {
      mask |= com.jogamp.newt.event.InputEvent.ALT_MASK;
    }

    if ((awtExtendedModifiers & java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
      mask |= com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK;
    }

    for (int n = 0; n < _numButtonsToTest; ++n) {
      if ((awtExtendedModifiers & getAWTButtonMask(n + 1)) != 0) {
        mask |= com.jogamp.newt.event.InputEvent.getButtonMask(n + 1);
      }
    }

    return mask;
  }
Exemplo n.º 2
0
    private synchronized void _checkModifiers(com.jogamp.newt.event.MouseEvent hasEvent) {
      if (_modifierCheckEnabled) {

        final MouseEvent expEvent =
            new MouseEvent(
                hasEvent.getEventType(),
                hasEvent.getSource(),
                hasEvent.getWhen(),
                _expectedModifiers,
                hasEvent.getX(),
                hasEvent.getY(),
                hasEvent.getClickCount(),
                hasEvent.getButton(),
                hasEvent.getRotation(),
                hasEvent.getRotationScale());

        _checkModifierMask(
            expEvent, hasEvent, com.jogamp.newt.event.InputEvent.SHIFT_MASK, "shift");
        _checkModifierMask(expEvent, hasEvent, com.jogamp.newt.event.InputEvent.CTRL_MASK, "ctrl");
        _checkModifierMask(expEvent, hasEvent, com.jogamp.newt.event.InputEvent.META_MASK, "meta");
        _checkModifierMask(expEvent, hasEvent, com.jogamp.newt.event.InputEvent.ALT_MASK, "alt");
        _checkModifierMask(
            expEvent, hasEvent, com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK, "graph");

        for (int n = 0; n < _numButtonsToTest; ++n) {
          _checkModifierMask(
              expEvent,
              hasEvent,
              com.jogamp.newt.event.InputEvent.getButtonMask(n + 1),
              "button" + (n + 1));
        }
      }
    }