From 21cde04129ea241744b95cad8fd0a545d3474b05 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 24 Mar 2013 14:07:11 +0100 Subject: Android/NEWT MouseEvent: Fix Detection/Processing of 2-Finger-Scroll Gesture - Part 2 Multiple tests on different devices disclosed that: - 1 of 2 pointers get disconnected every now and then .. -> Shall tolerate this case - dist-delta within gesture may shrink below doubleTouchSlope -> Remove constraint after gesture detection - Always validate pointer-id GearsES2 - Works quite stable on several devices now - Moved soft-keyboad show to 4-pointer pressed >= 0.7f pressure --- .../jogamp/opengl/test/android/MovieCubeActivity0.java | 2 +- .../opengl/test/android/NEWTGearsES2ActivityLauncher.java | 1 + .../jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java | 15 +++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src/test/com/jogamp/opengl') diff --git a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java index 6aa2a045e..3e61e509c 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java +++ b/src/test/com/jogamp/opengl/test/android/MovieCubeActivity0.java @@ -54,7 +54,7 @@ public class MovieCubeActivity0 extends NewtBaseActivity { MouseAdapter showKeyboardMouseListener = new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { - if(e.getPressure(true)>0.8f) { + if( e.getPointerCount() == 4 && e.getPressure(true) > 0.7f ) { ((com.jogamp.newt.Window) e.getSource()).setKeyboardVisible(true); } } diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java index 35cf9e7dd..af5b70776 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2ActivityLauncher.java @@ -60,6 +60,7 @@ public class NEWTGearsES2ActivityLauncher extends LauncherUtil.BaseActivityLaunc props.setProperty("newt.debug.Window", "true"); props.setProperty("newt.debug.Window.MouseEvent", "true"); props.setProperty("newt.debug.Window.KeyEvent", "true"); + // props.setProperty("newt.debug.Android.MouseEvent", "true"); } @Override diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java index 06635f2d5..49f1940dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java @@ -434,12 +434,15 @@ public class GearsES2 implements GLEventListener { } public void mousePressed(MouseEvent e) { - if( !gesture2PtrZoom.isWithinGesture() && e.getPointerCount()==1 ) { - prevMouseX = e.getX(); - prevMouseY = e.getY(); - Object src = e.getSource(); - if(e.getPressure(true)>0.8f && src instanceof Window) { // show Keyboard - ((Window) src).setKeyboardVisible(true); + if( !gesture2PtrZoom.isWithinGesture() ) { + if( e.getPointerCount()==1 ) { + prevMouseX = e.getX(); + prevMouseY = e.getY(); + } else if( e.getPointerCount() == 4 ) { + final Object src = e.getSource(); + if( e.getPressure(true) > 0.7f && src instanceof Window) { // show Keyboard + ((Window) src).setKeyboardVisible(true); + } } } } -- cgit v1.2.3