diff options
author | Sven Gothel <[email protected]> | 2013-10-18 02:27:33 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-18 02:27:33 +0200 |
commit | 2ebf1bf35928e35ded6e38df64dee7aa578ae3c7 (patch) | |
tree | f8c97485af0ee4e6246449b5df1324bea45efc7c /src/newt/classes/jogamp | |
parent | 77b0adbdb6e361e4d5d6ca31432e8fc625d02b24 (diff) |
MouseEvent: Clarify button-number and pointer-ID relation incl. case 'no button/pointer', i.e. button == 0, pointer-ID == -1
doPointerEvent:
- allow id==-1 -> button==0 for no button, i.e. mouse move
doMouseEvent:
- keep button 0 value, i.e. map to pointer-ID -1
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 3f59da553..a35d89408 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2381,8 +2381,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int x, int y, short button, final float[] rotationXYZ, float rotationScale) { if( 0 > button || button > MouseEvent.BUTTON_COUNT ) { throw new NativeWindowException("Invalid mouse button number" + button); - } else if( 0 == button ) { - button = 1; } doPointerEvent(enqueue, wait, constMousePointerTypes, eventType, modifiers, 0 /*actionIdx*/, new short[] { (short)(button-1) }, @@ -2467,7 +2465,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer * @param eventType * @param modifiers * @param pActionIdx index of multiple-pointer arrays representing the pointer which triggered the event - * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0. + * @param pID Pointer ID for each pointer (multiple pointer). We assume consecutive pointerIDs starting w/ 0. + * A pointer-ID of -1 may also denote no pointer/button activity, i.e. {@link PointerType#Mouse} move. * @param pX X-axis for each pointer (multiple pointer) * @param pY Y-axis for each pointer (multiple pointer) * @param pPressure Pressure for each pointer (multiple pointer) @@ -2513,7 +2512,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final short button; { final int b = id + 1; - if( com.jogamp.newt.event.MouseEvent.BUTTON1 <= b && b <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) { + if( 0 <= b && b <= com.jogamp.newt.event.MouseEvent.BUTTON_COUNT ) { // we allow id==-1 -> button==0 for no button, i.e. mouse move button = (short)b; } else { button = com.jogamp.newt.event.MouseEvent.BUTTON1; @@ -2580,7 +2579,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0); } - modifiers |= InputEvent.getButtonMask(button); // Always add current button to modifier mask (Bug 571) + final int buttonMask = InputEvent.getButtonMask(button); + modifiers |= buttonMask; // Always add current button to modifier mask (Bug 571) modifiers |= pState1.buttonPressedMask; // Always add currently pressed mouse buttons to modifier mask if( isPointerConfined() ) { @@ -2609,7 +2609,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if( 0 >= pPressure[0] ) { pPressure[0] = maxPressure; } - pState1.buttonPressedMask |= InputEvent.getButtonMask(button); + pState1.buttonPressedMask |= buttonMask; if( 1 == pCount ) { if( when - pState1.lastButtonPressTime < MouseEvent.getClickTimeout() ) { pState1.lastButtonClickCount++; @@ -2638,7 +2638,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer e = new MouseEvent(eventType, this, when, modifiers, pTypes, pID, pX, pY, pPressure, maxPressure, button, (short)1, rotationXYZ, rotationScale); } - pState1.buttonPressedMask &= ~InputEvent.getButtonMask(button); + pState1.buttonPressedMask &= ~buttonMask; if( null != movePositionP0 ) { movePositionP0.set(0, 0); } |