summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/button-android.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-10-31 15:32:57 +0000
committerThomas Martitz <kugel@rockbox.org>2010-10-31 15:32:57 +0000
commit49f1ec8e8ad0b4c06df01fcdd4b18037fbe3ebcc (patch)
treeb185e604dcea64865389f5b149e754ba8ffd3f75 /firmware/target/hosted/android/button-android.c
parentdbe2ac1ec6f4ed88f267d2a4df024b6dc42a87ff (diff)
downloadrockbox-49f1ec8e8ad0b4c06df01fcdd4b18037fbe3ebcc.tar.gz
rockbox-49f1ec8e8ad0b4c06df01fcdd4b18037fbe3ebcc.zip
Add support multimedia keys/buttons to the core, and adapt Rockbox on android for it (multimedia buttons are found on wired headsets and the lock screen in cyanogenmod).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28421 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/hosted/android/button-android.c')
-rw-r--r--firmware/target/hosted/android/button-android.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/firmware/target/hosted/android/button-android.c b/firmware/target/hosted/android/button-android.c
index c072e3e38b..9bf15c25a2 100644
--- a/firmware/target/hosted/android/button-android.c
+++ b/firmware/target/hosted/android/button-android.c
@@ -28,7 +28,7 @@
28#include "kernel.h" 28#include "kernel.h"
29#include "system.h" 29#include "system.h"
30#include "touchscreen.h" 30#include "touchscreen.h"
31 31#include "debug.h"
32static int last_y, last_x; 32static int last_y, last_x;
33static int last_btns; 33static int last_btns;
34static long last_button_tick; 34static long last_button_tick;
@@ -44,7 +44,7 @@ static enum {
44 * began or stopped the touch action + where (pixel coordinates) */ 44 * began or stopped the touch action + where (pixel coordinates) */
45JNIEXPORT void JNICALL 45JNIEXPORT void JNICALL
46Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this, 46Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this,
47 bool down, int x, int y) 47 jboolean down, jint x, jint y)
48{ 48{
49 (void)env; 49 (void)env;
50 (void)this; 50 (void)this;
@@ -63,12 +63,23 @@ Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this,
63 * generated by pressing/releasing them to a variable */ 63 * generated by pressing/releasing them to a variable */
64JNIEXPORT bool JNICALL 64JNIEXPORT bool JNICALL
65Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jobject this, 65Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jobject this,
66 int keycode, bool state) 66 jint keycode, jboolean state)
67{ 67{
68 (void)env; 68 (void)env;
69 (void)this; 69 (void)this;
70 70
71 int button = key_to_button(keycode); 71 unsigned button = 0;
72
73 if (!state)
74 button = multimedia_to_button((int)keycode);
75
76 if (button)
77 { /* multimeida buttons are handled differently */
78 queue_post(&button_queue, button, 0);
79 return true;
80 }
81
82 button = key_to_button(keycode);
72 83
73 if (button == BUTTON_NONE) 84 if (button == BUTTON_NONE)
74 return false; 85 return false;