diff options
author | Sven Gothel <[email protected]> | 2014-04-09 16:40:13 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-04-09 16:40:13 +0200 |
commit | 11021769c78343b842b723a432a08946a65a1ceb (patch) | |
tree | 2b161dc522979ffb36d165f9c118f806471c2b12 /src/newt/classes/com/jogamp | |
parent | 38365e14977714df3f19fb6b5880dd6f4d4d5743 (diff) |
NEWT MouseEvent: Decouple pointerIds from single-pointer button, i.e. always use proper pointerId >= 0
In case of single-pointer mouse events, always use pointerId 0,
don't derive from button name.
Multiple pointer events still derive button name from the 'action' pointerId.
This allows applications to utilize pointerId equally for single and multiple
pointer events.
Passed all 'junit.run.newt.event' unit tests
Diffstat (limited to 'src/newt/classes/com/jogamp')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/MouseEvent.java | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index 84c78727e..fb74b5a09 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -49,23 +49,17 @@ package com.jogamp.newt.event; * For example {@link #getX(int) e.getX(0)} at {@link #EVENT_MOUSE_PRESSED} returns the data of the pressed pointer, etc. * </p> * <p> - * A {@link #getButton() button value} of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move. - * </p> - * <p> - * A {@link #getPointerId(int) pointer-ID} of -1 denotes no pointer/button activity, i.e. {@link PointerType#Mouse} move. + * Multiple-pointer event's {@link #getButton() button number} is mapped to the <i>first {@link #getPointerId(int) pointer ID}</i> + * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers} + * field represent the pressed pointer IDs. * </p> * <p> - * {@link #getButton() Button values} are mapped from and to {@link #getPointerId(int) pointer-IDs} as follows: - * <code> - * getPointerId(0) == getButton() - 1 - * </code>. + * Users can query the pressed button and pointer count via {@link InputEvent#getButtonDownCount()} + * or use the simple query {@link InputEvent#isAnyButtonDown()}. * </p> * <p> - * If representing a multiple-pointer event, the {@link #getButton() button number} is mapped to the <i>first {@link #getPointerId(int) pointer ID}</i> - * triggering the event and the {@link InputEvent#BUTTON1_MASK button mask bits} in the {@link #getModifiers() modifiers} - * field represent the pressed pointer IDs.<br> - * Hence users can query the pressed button count as well as the pressed pointer count via {@link InputEvent#getButtonDownCount()} - * or use the simple query {@link InputEvent#isAnyButtonDown()}. + * If representing a single-pointer {@link PointerType#Mouse} event, {@link #getPointerId(int) pointer-ID} is <code>0</code> + * and a {@link #getButton() button value} of <code>0</code> denotes no button activity, i.e. {@link PointerType#Mouse} move. * </p> */ @SuppressWarnings("serial") @@ -206,7 +200,7 @@ public class MouseEvent extends InputEvent this.pressure = constMousePressure0; } this.maxPressure= 1.0f; - this.pointerID = new short[] { (short)(button - 1) }; + this.pointerID = new short[] { (short)0 }; this.clickCount=clickCount; this.button=button; this.rotationXYZ = rotationXYZ; @@ -305,9 +299,6 @@ public class MouseEvent extends InputEvent * IDs start w/ 0 and are consecutive numbers. * </p> * <p> - * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move. - * </p> - * <p> * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * </p> */ @@ -556,12 +547,7 @@ public class MouseEvent extends InputEvent /** PointerType for each pointer (multiple pointer) */ private final PointerType pointerType[]; - /** - * Pointer-ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers. - * <p> - * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move. - * </p> - */ + /** Pointer-ID for each pointer (multiple pointer). IDs start w/ 0 and are consecutive numbers. */ private final short pointerID[]; /** X-axis for each pointer (multiple pointer) */ private final int x[]; |