aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-08-09 21:29:54 +0200
committerSven Gothel <[email protected]>2011-08-09 21:29:54 +0200
commit5cf183b50d0f50d1831a6df1fa2bb70044732358 (patch)
treed26e321ac591521cecd67327c9ca8db4767ed309
parent0ebb4132e41a44e4a8a1dada39b824f88c48603d (diff)
Add touch event propagation to NEWT
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
index 8d26c80c0..795426c9e 100644
--- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
+++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java
@@ -30,6 +30,7 @@ package jogamp.newt.driver.android;
import java.nio.IntBuffer;
+import jogamp.newt.WindowImpl;
import jogamp.newt.driver.android.event.AndroidNewtEventFactory;
import javax.media.nativewindow.GraphicsConfigurationFactory;
import javax.media.nativewindow.NativeWindowException;
@@ -86,6 +87,14 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
public AndroidWindow(Context ctx) {
nsv = new MSurfaceView(ctx);
+ nsv.setOnTouchListener(new View.OnTouchListener() {
+ public boolean onTouch(View v, android.view.MotionEvent aEvent) {
+ MouseEvent newtEvent = AndroidNewtEventFactory.createMouseEvent(aEvent, AndroidWindow.this);
+ AndroidWindow.this.enqueueEvent(false, newtEvent);
+ return true;
+ }
+
+ });
SurfaceHolder sh = nsv.getHolder();
sh.setFormat(getPixelFormat());
sh.setType(SurfaceHolder.SURFACE_TYPE_NORMAL);
@@ -244,19 +253,6 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 {
volatile long surfaceHandle = 0;
long eglSurface = 0;
- class MouseInterceptor implements OnClickListener, OnTouchListener {
-
- public void onClick(View v) {
- // TODO Auto-generated method stub
- }
-
- public boolean onTouch(View v, MotionEvent event) {
- // MouseEvent event = AndroidNewtEventFactory.createMouseEvent(event, AndroidWindow.this);
-
- return false;
- }
-
- }
static class MSurfaceView extends SurfaceView {
public MSurfaceView (Context ctx) {
super(ctx);