summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-01-14 05:58:21 +0100
committerSven Gothel <[email protected]>2013-01-14 05:58:21 +0100
commitda14d647581751f3d2f6d651741eaec485e255b5 (patch)
treee8d228fa27ca2ccf5820abcd7c49a9f054377ae9 /src/nativewindow/classes
parent955a444939ba67c6077b6937e191719aa184dafe (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/nativewindow/classes')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java5
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java5
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java26
3 files changed, 23 insertions, 13 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
index acb4c84da..00741a328 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIUtil.java
@@ -34,7 +34,6 @@ import javax.media.nativewindow.NativeWindowFactory;
import jogamp.nativewindow.NWJNILibLoader;
import jogamp.nativewindow.Debug;
import jogamp.nativewindow.ToolkitProperties;
-import jogamp.nativewindow.x11.X11Util;
public class GDIUtil implements ToolkitProperties {
private static final boolean DEBUG = Debug.debug("GDIUtil");
@@ -49,7 +48,7 @@ public class GDIUtil implements ToolkitProperties {
*/
public static synchronized void initSingleton() {
if(!isInit) {
- synchronized(X11Util.class) {
+ synchronized(GDIUtil.class) {
if(!isInit) {
if(DEBUG) {
System.out.println("GDI.initSingleton()");
@@ -92,7 +91,7 @@ public class GDIUtil implements ToolkitProperties {
public static long CreateDummyWindow(int x, int y, int width, int height) {
synchronized(dummyWindowSync) {
dummyWindowClass = dummyWindowClassFactory.getSharedClass();
- return CreateDummyWindow0(dummyWindowClass.getHandle(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height);
+ return CreateDummyWindow0(dummyWindowClass.getHInstance(), dummyWindowClass.getName(), dummyWindowClass.getName(), x, y, width, height);
}
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
index afb3daf7c..949f5d06d 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClass.java
@@ -37,7 +37,10 @@ public class RegisteredClass {
className = name;
}
- public final long getHandle() { return hInstance; }
+ /** Application handle, same as {@link RegisteredClassFactory#getHInstance()}. */
+ public final long getHInstance() { return hInstance; }
+
+ /** Unique Window Class Name */
public final String getName() { return className; }
@Override
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
index 00bedfc8e..0280b0df7 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/RegisteredClassFactory.java
@@ -33,8 +33,17 @@ import java.util.ArrayList;
import javax.media.nativewindow.NativeWindowException;
public class RegisteredClassFactory {
- static final boolean DEBUG = Debug.debug("RegisteredClass");
- private static ArrayList<RegisteredClassFactory> registeredFactories = new ArrayList<RegisteredClassFactory>();
+ private static final boolean DEBUG = Debug.debug("RegisteredClass");
+ private static final ArrayList<RegisteredClassFactory> registeredFactories;
+ private static final long hInstance;
+
+ static {
+ hInstance = GDI.GetApplicationHandle();
+ if( 0 == hInstance ) {
+ throw new NativeWindowException("Error: Null ModuleHandle for Application");
+ }
+ registeredFactories = new ArrayList<RegisteredClassFactory>();
+ }
private String classBaseName;
private long wndProc;
@@ -43,7 +52,7 @@ public class RegisteredClassFactory {
private int classIter = 0;
private int sharedRefCount = 0;
private final Object sync = new Object();
-
+
/**
* Release the {@link RegisteredClass} of all {@link RegisteredClassFactory}.
*/
@@ -53,7 +62,7 @@ public class RegisteredClassFactory {
final RegisteredClassFactory rcf = registeredFactories.get(j);
synchronized(rcf.sync) {
if(null != rcf.sharedClass) {
- GDIUtil.DestroyWindowClass(rcf.sharedClass.getHandle(), rcf.sharedClass.getName());
+ GDIUtil.DestroyWindowClass(rcf.sharedClass.getHInstance(), rcf.sharedClass.getName());
rcf.sharedClass = null;
rcf.sharedRefCount = 0;
rcf.classIter = 0;
@@ -65,6 +74,9 @@ public class RegisteredClassFactory {
}
}
}
+
+ /** Application handle. */
+ public static long getHInstance() { return hInstance; }
public RegisteredClassFactory(String classBaseName, long wndProc) {
this.classBaseName = classBaseName;
@@ -80,10 +92,6 @@ public class RegisteredClassFactory {
if( null != sharedClass ) {
throw new InternalError("Error ("+sharedRefCount+"): SharedClass not null: "+sharedClass);
}
- long hInstance = GDI.GetApplicationHandle();
- if( 0 == hInstance ) {
- throw new NativeWindowException("Error: Null ModuleHandle for Application");
- }
String clazzName = null;
boolean registered = false;
final int classIterMark = classIter - 1;
@@ -121,7 +129,7 @@ public class RegisteredClassFactory {
throw new InternalError("Error ("+sharedRefCount+"): SharedClass is null");
}
if( 0 == sharedRefCount ) {
- GDIUtil.DestroyWindowClass(sharedClass.getHandle(), sharedClass.getName());
+ GDIUtil.DestroyWindowClass(sharedClass.getHInstance(), sharedClass.getName());
if(DEBUG) {
System.err.println("RegisteredClassFactory releaseSharedClass ("+sharedRefCount+") released: "+sharedClass);
}