diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-08-16 20:12:10 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-08-16 20:12:10 +0000 |
commit | 5068891477a7890bef94092fd184f7b30aa17b9d (patch) | |
tree | 5c51141221c2e444143a0bae42fb8b82bb348c69 /android/src/org/rockbox/RockboxFramebuffer.java | |
parent | 934a5a5808c7a0b0dff469ad2c3a523e78a4ef4b (diff) |
Android port: simplify sending touch events from Java->C
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27833 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android/src/org/rockbox/RockboxFramebuffer.java')
-rw-r--r-- | android/src/org/rockbox/RockboxFramebuffer.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/android/src/org/rockbox/RockboxFramebuffer.java b/android/src/org/rockbox/RockboxFramebuffer.java index 1734b4fab1..6d11e1af14 100644 --- a/android/src/org/rockbox/RockboxFramebuffer.java +++ b/android/src/org/rockbox/RockboxFramebuffer.java @@ -80,20 +80,22 @@ public class RockboxFramebuffer extends View public boolean onTouchEvent(MotionEvent me) { + int x = (int) me.getX(); + int y = (int) me.getY(); + switch (me.getAction()) { case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: - touchHandler(0); - break; + touchHandler(false, x, y); + return true; case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_DOWN: - touchHandler(1); - break; - + touchHandler(true, x, y); + return true; } - pixelHandler((int)me.getX(), (int)me.getY()); - return true; + + return false; } public boolean onKeyDown(int keyCode, KeyEvent event) @@ -118,7 +120,6 @@ public class RockboxFramebuffer extends View } public native void set_lcd_active(int active); - public native void pixelHandler(int x, int y); - public native void touchHandler(int down); + public native void touchHandler(boolean down, int x, int y); public native boolean buttonHandler(int keycode, boolean state); } |