diff options
author | Sven Gothel <[email protected]> | 2013-01-14 05:58:21 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-01-14 05:58:21 +0100 |
commit | da14d647581751f3d2f6d651741eaec485e255b5 (patch) | |
tree | e8d228fa27ca2ccf5820abcd7c49a9f054377ae9 /src/newt/classes/com | |
parent | 955a444939ba67c6077b6937e191719aa184dafe (diff) |
NEWT-MouseEvent getWheelRotation() API Update - Fixes Bug 659: NEWT Horizontal Scrolling Behavior (OSX, X11, Win32); Bug 639: High-Res Mouse-Wheel
- API update 'float getWheelRotation()':
Usually a wheel rotation of > 0.0f is up, and < 0.0f is down.
Usually a wheel rotations is considered a vertical scroll.
If isShiftDown(), a wheel rotations is considered a horizontal scroll,
where shift-up = left = > 0.0f, and shift-down = right = < 0.0f.
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.0f and 1.0f.
Higher values may result due to fast scrolling.
Fractional values may result due to slow scrolling with high resolution devices.
The button number refers to the wheel number.
- Fix Bug 659: NEWT Horizontal Scrolling Behavior (OSX, X11, Win32)
- See new API doc above
- X11/Horiz: Keep using button1 and set SHIFT modifier
- OSX/Horiz:
- PAD: Use highes absolute scrolling value (Axis1/Axis2)
and set SHIFT modifier for horizontal scrolling (Axis2)
- XXX: Use deltaX for horizontal scrolling, detected by SHIFT modifier. (traditional)
- Windows/Horiz:
- Add WM_MOUSEHWHEEL support (-> set SHIFT modifier), but it's rarely impl. for trackpads!
- Add exp. WM_HSCROLL, but it will only be delivered if windows has WS_HSCROLL, hence dead code!
- Android:
- Add ACTION_SCROLL (API Level 12), only used if layout is a scroll layout
- Using GestureDetector to detect scroll even w/ pointerCount > 2, while:
- skipping 1st scroll event (value too high)
- skipping other events while in-scroll mode
- waiting until all pointers were released before cont. normally
- using View config's 1/touchSlope as scale factor
- Fix Bug 639: High-Res Mouse-Wheel
- getWheelRotation() return value changed: int -> float
allowing fractions, see API doc changes above.
- Fractions are currently supported natively (API) on
- Windows
- OSX
- Android
- AndroidNewtEventFactory ir refactored (requires an instance now) and
AndroidNewtEventTranslator (event listener) is pulled our of Android WindowDriver.
Diffstat (limited to 'src/newt/classes/com')
-rw-r--r-- | src/newt/classes/com/jogamp/newt/NewtFactory.java | 8 | ||||
-rw-r--r-- | src/newt/classes/com/jogamp/newt/event/MouseEvent.java | 24 |
2 files changed, 21 insertions, 11 deletions
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index b3e904310..e66b2f624 100644 --- a/src/newt/classes/com/jogamp/newt/NewtFactory.java +++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java @@ -44,8 +44,6 @@ import javax.media.nativewindow.CapabilitiesImmutable; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.NativeWindowFactory; -import com.jogamp.common.os.Platform; - import jogamp.newt.Debug; import jogamp.newt.DisplayImpl; import jogamp.newt.ScreenImpl; @@ -56,13 +54,15 @@ public class NewtFactory { public static final String DRIVER_DEFAULT_ROOT_PACKAGE = "jogamp.newt.driver"; - // Work-around for initialization order problems on Mac OS X - // between native Newt and (apparently) Fmod static { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { NativeWindowFactory.initSingleton(); // last resort .. + + // Work-around for initialization order problems on Mac OS X + // between native Newt and (apparently) Fmod WindowImpl.init(NativeWindowFactory.getNativeWindowType(true)); + return null; } } ); } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index 914aaa647..e6b3d8a24 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -65,7 +65,7 @@ public class MouseEvent extends InputEvent public MouseEvent(int eventType, Object source, long when, int modifiers, int x, int y, int clickCount, int button, - int rotation) + float rotation) { super(eventType, source, when, modifiers); this.x = new int[]{x}; @@ -79,7 +79,7 @@ public class MouseEvent extends InputEvent public MouseEvent(int eventType, Object source, long when, int modifiers, int[] x, int[] y, float[] pressure, int[] pointerids, int clickCount, int button, - int rotation) + float rotation) { super(eventType, source, when, modifiers); this.x = x; @@ -154,20 +154,29 @@ public class MouseEvent extends InputEvent } /** - * <i>Usually</i> a wheel rotation of <b>> 0 is up</b>, - * and <b>< 0 is down</b>.<br> + * <i>Usually</i> a wheel rotation of <b>> 0.0f is up</b>, + * and <b>< 0.0f is down</b>. + * <p> + * Usually a wheel rotations is considered a vertical scroll.<br/> + * If {@link #isShiftDown()}, a wheel rotations is + * considered a horizontal scroll, where <b>shift-up = left = > 0.0f</b>, + * and <b>shift-down = right = < 0.0f</b>. + * </p> + * <p> * <i>However</i>, on some OS this might be flipped due to the OS <i>default</i> behavior. * The latter is true for OS X 10.7 (Lion) for example. + * </p> * <p> - * The events will be send usually in steps of one, ie. <i>-1</i> and <i>1</i>. + * The events will be send usually in steps of one, ie. <i>-1.0f</i> and <i>1.0f</i>. * Higher values may result due to fast scrolling. + * Fractional values may result due to slow scrolling with high resolution devices. * </p> * <p> * The button number refers to the wheel number. * </p> * @return */ - public int getWheelRotation() { + public float getWheelRotation() { return wheelRotation; } @@ -212,7 +221,8 @@ public class MouseEvent extends InputEvent default: return "unknown (" + type + ")"; } } - private final int x[], y[], clickCount, button, wheelRotation; + private final int x[], y[], clickCount, button; + private final float wheelRotation; private final float pressure[]; private final int pointerids[]; |