From 30c959a4534bc0c6b4718ae65fd4f91d68d6eca6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 2 Dec 2011 07:54:41 +0100 Subject: NEWT EVENT_MOUSE_WHEEL_MOVED: Fix Bug 413 - Generate proper mouse wheel events. > 0: UP < 0: DOWN See MouseEvent.getWheelRotation() for details. OSX/Windows: Default to wheel 'button' 1 OSX: Properly report '<0' X11: Synthesize wheel events by mapping buttons 4/5 and 6/7 to wheel 1 and 2. --- src/newt/classes/com/jogamp/newt/event/MouseEvent.java | 14 ++++++++++++++ src/newt/classes/com/jogamp/newt/event/MouseListener.java | 2 ++ 2 files changed, 16 insertions(+) (limited to 'src/newt/classes/com/jogamp') diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index ccc674f1d..9bc3be1e5 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -139,6 +139,20 @@ public class MouseEvent extends InputEvent return pressure[index]; } + /** + * Usually a wheel rotation of > 0 is up, + * and < 0 is down.
+ * However, on some OS this might be flipped due to the OS default behavior. + * The latter is true for OS X 10.7 (Lion) for example. + *

+ * The events will be send usually in steps of one, ie. -1 and 1. + * Higher values may result due to fast scrolling. + *

+ *

+ * The button number refers to the wheel number. + *

+ * @return + */ public int getWheelRotation() { return wheelRotation; } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseListener.java b/src/newt/classes/com/jogamp/newt/event/MouseListener.java index 5ec086b94..7668b755c 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseListener.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseListener.java @@ -43,6 +43,8 @@ public interface MouseListener extends NEWTEventListener public void mouseReleased(MouseEvent e); public void mouseMoved(MouseEvent e); public void mouseDragged(MouseEvent e); + + /** See {@link MouseEvent#getWheelRotation() } */ public void mouseWheelMoved(MouseEvent e); } -- cgit v1.2.3