diff options
3 files changed, 17 insertions, 3 deletions
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java index 5dcd4d962..115743a0d 100644 --- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java +++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java @@ -30,7 +30,9 @@ package com.jogamp.newt.event.awt; import jogamp.newt.awt.event.AWTNewtEventFactory; -public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener +public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseListener, + java.awt.event.MouseMotionListener, + java.awt.event.MouseWheelListener { public AWTMouseAdapter(com.jogamp.newt.event.MouseListener newtListener) { super(newtListener); @@ -47,12 +49,14 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL public AWTAdapter addTo(java.awt.Component awtComponent) { awtComponent.addMouseListener(this); awtComponent.addMouseMotionListener(this); + awtComponent.addMouseWheelListener(this); return this; } public AWTAdapter removeFrom(java.awt.Component awtComponent) { awtComponent.removeMouseListener(this); awtComponent.removeMouseMotionListener(this); + awtComponent.removeMouseWheelListener(this); return this; } @@ -118,5 +122,14 @@ public class AWTMouseAdapter extends AWTAdapter implements java.awt.event.MouseL enqueueEvent(false, event); } } + + public void mouseWheelMoved(java.awt.event.MouseWheelEvent e) { + com.jogamp.newt.event.MouseEvent event = AWTNewtEventFactory.createMouseEvent(e, newtWindow); + if(null!=newtListener) { + ((com.jogamp.newt.event.MouseListener)newtListener).mouseWheelMoved(event); + } else { + enqueueEvent(false, event); + } + } } diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java index d64cc9359..cb70da13f 100644 --- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java +++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java @@ -120,7 +120,8 @@ public class AWTNewtEventFactory { if(0xFFFFFFFF != type) { int rotation = 0; if (event instanceof java.awt.event.MouseWheelEvent) { - rotation = ((java.awt.event.MouseWheelEvent)event).getWheelRotation(); + // AWT/NEWT rotation is reversed - AWT +1 is down, NEWT +1 is up. + rotation = -1 * ((java.awt.event.MouseWheelEvent)event).getWheelRotation(); } int mods = awtModifiers2Newt(event.getModifiers(), true); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java index a02cb7e7a..f39b5df3b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParentingFocusTraversal01AWT.java @@ -65,7 +65,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; public class TestParentingFocusTraversal01AWT extends UITestCase { static Dimension glSize, fSize; static int numFocus = 8; - static long durationPerTest = numFocus * 100; + static long durationPerTest = numFocus * 200; static GLCapabilities glCaps; static boolean manual = false; |