diff options
Diffstat (limited to 'src/newt/classes/jogamp')
4 files changed, 43 insertions, 28 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 16d252ca3..805ad08ad 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2133,17 +2133,29 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // // MouseListener/Event Support // - public void sendMouseEvent(short eventType, int modifiers, - int x, int y, short button, float rotation) { + public final void sendMouseEvent(short eventType, int modifiers, + int x, int y, short button, float rotation) { doMouseEvent(false, false, eventType, modifiers, x, y, button, rotation); } - public void enqueueMouseEvent(boolean wait, short eventType, int modifiers, - int x, int y, short button, float rotation) { + public final void enqueueMouseEvent(boolean wait, short eventType, int modifiers, + int x, int y, short button, float rotation) { doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotation); } - + protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers, + int x, int y, short button, float rotation) { + this.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, MouseEvent.getRotationXYZ(rotation, modifiers), 1f); + } + /** + public final void sendMouseEvent(short eventType, int modifiers, + int x, int y, short button, float[] rotationXYZ, float rotationScale) { + doMouseEvent(false, false, eventType, modifiers, x, y, button, rotationXYZ, rotationScale); + } + public final void enqueueMouseEvent(boolean wait, short eventType, int modifiers, + int x, int y, short button, float[] rotationXYZ, float rotationScale) { + doMouseEvent(true, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale); + } */ protected void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers, - int x, int y, short button, float rotation) { + int x, int y, short button, float[] rotationXYZ, float rotationScale) { if( eventType == MouseEvent.EVENT_MOUSE_ENTERED || eventType == MouseEvent.EVENT_MOUSE_EXITED ) { if( eventType == MouseEvent.EVENT_MOUSE_EXITED && x==-1 && y==-1 ) { x = lastMousePosition.getX(); @@ -2172,7 +2184,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!mouseInWindow) { mouseInWindow = true; eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, this, when, - modifiers, x, y, (short)0, (short)0, (short)0); + modifiers, x, y, (short)0, (short)0, rotationXYZ, rotationScale); // clear states lastMousePressed = 0; lastMouseClickCount = (short)0; @@ -2213,13 +2225,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer mouseButtonPressed = button; mouseButtonModMask |= MouseEvent.getButtonMask(button); e = new MouseEvent(eventType, this, when, - modifiers, x, y, lastMouseClickCount, button, 0); + modifiers, x, y, lastMouseClickCount, button, rotationXYZ, rotationScale); } else if( MouseEvent.EVENT_MOUSE_RELEASED == eventType ) { e = new MouseEvent(eventType, this, when, - modifiers, x, y, lastMouseClickCount, button, 0); + modifiers, x, y, lastMouseClickCount, button, rotationXYZ, rotationScale); if( when - lastMousePressed < MouseEvent.getClickTimeout() ) { eClicked = new MouseEvent(MouseEvent.EVENT_MOUSE_CLICKED, this, when, - modifiers, x, y, lastMouseClickCount, button, 0); + modifiers, x, y, lastMouseClickCount, button, rotationXYZ, rotationScale); } else { lastMouseClickCount = (short)0; lastMousePressed = 0; @@ -2229,15 +2241,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } else if( MouseEvent.EVENT_MOUSE_MOVED == eventType ) { if ( mouseButtonPressed > 0 ) { e = new MouseEvent(MouseEvent.EVENT_MOUSE_DRAGGED, this, when, - modifiers, x, y, (short)1, mouseButtonPressed, 0); + modifiers, x, y, (short)1, mouseButtonPressed, rotationXYZ, rotationScale); } else { e = new MouseEvent(eventType, this, when, - modifiers, x, y, (short)0, button, (short)0); + modifiers, x, y, (short)0, button, rotationXYZ, rotationScale); } } else if( MouseEvent.EVENT_MOUSE_WHEEL_MOVED == eventType ) { - e = new MouseEvent(eventType, this, when, modifiers, x, y, (short)0, button, rotation); + e = new MouseEvent(eventType, this, when, modifiers, x, y, (short)0, button, rotationXYZ, rotationScale); } else { - e = new MouseEvent(eventType, this, when, modifiers, x, y, (short)0, button, 0); + e = new MouseEvent(eventType, this, when, modifiers, x, y, (short)0, button, rotationXYZ, rotationScale); } if( null != eEntered ) { if(DEBUG_MOUSE_EVENT) { diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java index a1aa69e0a..1e15070f8 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java @@ -28,6 +28,8 @@ package jogamp.newt.awt.event; +import com.jogamp.newt.event.MouseEvent; + /** * * <a name="AWTEventModifierMapping"><h5>AWT Event Modifier Mapping</h5></a> @@ -635,7 +637,7 @@ public class AWTNewtEventFactory { return new com.jogamp.newt.event.MouseEvent( newtType, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(), mods, event.getX(), event.getY(), (short)event.getClickCount(), - newtButton, rotation); + newtButton, MouseEvent.getRotationXYZ(rotation, mods), 1f); } return null; // no mapping .. } diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index fcc5b2148..69a09c1f9 100644 --- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java @@ -228,7 +228,7 @@ public class WindowDriver extends WindowImpl { @Override protected final void doMouseEvent(boolean enqueue, boolean wait, short eventType, int modifiers, - int x, int y, short button, float rotation) { + int x, int y, short button, float[] rotationXYZ, float rotationScale) { switch(eventType) { case MouseEvent.EVENT_MOUSE_PRESSED: switch(button) { @@ -242,32 +242,32 @@ public class WindowDriver extends WindowImpl { break; case MouseEvent.EVENT_MOUSE_RELEASED: switch(button) { - case X11_WHEEL_ONE_UP_BUTTON: + case X11_WHEEL_ONE_UP_BUTTON: // vertical scroll up eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED; button = 1; - rotation = 1; + rotationXYZ[1] = 1; break; - case X11_WHEEL_ONE_DOWN_BUTTON: + case X11_WHEEL_ONE_DOWN_BUTTON: // vertical scroll down eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED; button = 1; - rotation = -1; + rotationXYZ[1] = -1; break; - case X11_WHEEL_TWO_UP_BUTTON: // vertical scroll left + case X11_WHEEL_TWO_UP_BUTTON: // horizontal scroll left eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED; button = 1; - rotation = 1; + rotationXYZ[0] = 1; modifiers |= InputEvent.SHIFT_MASK; break; - case X11_WHEEL_TWO_DOWN_BUTTON: // vertical scroll right + case X11_WHEEL_TWO_DOWN_BUTTON: // horizontal scroll right eventType = MouseEvent.EVENT_MOUSE_WHEEL_MOVED; button = 1; - rotation = -1; + rotationXYZ[0] = -1; modifiers |= InputEvent.SHIFT_MASK; break; } break; } - super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotation); + super.doMouseEvent(enqueue, wait, eventType, modifiers, x, y, button, rotationXYZ, rotationScale); } protected final void sendKeyEvent(short eventType, int modifiers, short keyCode, short keySym, char keyChar0, String keyString) { diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java index 24a5c41de..1e99d1ef7 100644 --- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java @@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Listener; import com.jogamp.newt.event.InputEvent; +import com.jogamp.newt.event.MouseEvent; /** * SWT event translator to NEWT, inclusive dispatch listener. @@ -242,7 +243,7 @@ public class SWTNewtEventFactory { return new com.jogamp.newt.event.MouseEvent( type, (null==source)?(Object)event.data:source, (0xFFFFFFFFL & (long)event.time), - mods, event.x, event.y, (short)event.count, (short)event.button, rotation); + mods, event.x, event.y, (short)event.count, (short)event.button, MouseEvent.getRotationXYZ(rotation, mods), 1f); } return null; // no mapping .. } @@ -297,7 +298,7 @@ public class SWTNewtEventFactory { res.getSource(), res.getWhen(), res.getModifiers(), res.getX(), res.getY(), res.getClickCount(), - res.getButton(), res.getWheelRotation() ); + res.getButton(), res.getRotation(), res.getRotationScale()); l.mouseClicked(res2); } break; @@ -308,7 +309,7 @@ public class SWTNewtEventFactory { res.getSource(), res.getWhen(), res.getModifiers(), res.getX(), res.getY(), res.getClickCount(), - dragButtonDown, res.getWheelRotation() ); + dragButtonDown, res.getRotation(), res.getRotationScale()); l.mouseDragged( res2 ); } else { l.mouseMoved(res); |