private final long when;
/**
- * The modifiers in effect for this event. Package visible for use by
- * subclasses. The old style (bitmask 0x3f) should not be mixed with the
- * new style (bitmasks 0xffffffc0).
+ * The old-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
*
* @see #getModifiers()
* @see MouseEvent
- * @serial the modifier state, stored in the new style
+ * @serial the modifier state, stored in the old style
*/
int modifiers;
/**
+ * The new-style modifiers in effect for this event. Package visible
+ * for use by subclasses. The old style (bitmask 0x3f) should not be
+ * mixed with the new style (bitmasks 0xffffffc0).
+ *
+ * @see #getModifiersEx()
+ * @see MouseEvent
+ * @serial the modifier state, stored in the new style
+ */
+ int modifiersEx;
+
+ /**
* Initializes a new instance of <code>InputEvent</code> with the specified
* source, id, timestamp, and modifiers. Note that an invalid id leads to
* unspecified results.
{
super(source, id);
this.when = when;
- this.modifiers = EventModifier.extend(modifiers);
+ this.modifiers = modifiers & EventModifier.OLD_MASK;
+ this.modifiersEx = modifiers & EventModifier.NEW_MASK;
}
/**
*/
public boolean isShiftDown()
{
- return (modifiers & SHIFT_DOWN_MASK) != 0;
+ return ((modifiers & SHIFT_MASK) != 0)
+ || ((modifiersEx & SHIFT_DOWN_MASK) != 0);
}
/**
*/
public boolean isControlDown()
{
- return (modifiers & CTRL_DOWN_MASK) != 0;
+ return ((modifiers & CTRL_MASK) != 0)
+ || ((modifiersEx & CTRL_DOWN_MASK) != 0);
}
/**
*/
public boolean isMetaDown()
{
- return (modifiers & META_DOWN_MASK) != 0;
+ return ((modifiers & META_MASK) != 0)
+ || ((modifiersEx & META_DOWN_MASK) != 0);
}
/**
*/
public boolean isAltDown()
{
- return (modifiers & ALT_DOWN_MASK) != 0;
+ return ((modifiers & ALT_MASK) != 0)
+ || ((modifiersEx & ALT_DOWN_MASK) != 0);
}
/**
*/
public boolean isAltGraphDown()
{
- return (modifiers & ALT_GRAPH_DOWN_MASK) != 0;
+ return ((modifiers & ALT_GRAPH_MASK) != 0)
+ || ((modifiersEx & ALT_GRAPH_DOWN_MASK) != 0);
}
/**
*/
public int getModifiers()
{
- return EventModifier.revert(modifiers);
+ return modifiers;
}
/**
*/
public int getModifiersEx()
{
- return modifiers;
+ return modifiersEx;
}
/**