diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-10-31 15:32:57 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-10-31 15:32:57 +0000 |
commit | 49f1ec8e8ad0b4c06df01fcdd4b18037fbe3ebcc (patch) | |
tree | b185e604dcea64865389f5b149e754ba8ffd3f75 /firmware/target/hosted/android/button-android.c | |
parent | dbe2ac1ec6f4ed88f267d2a4df024b6dc42a87ff (diff) | |
download | rockbox-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.c | 19 |
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 @@ #include "kernel.h" #include "system.h" #include "touchscreen.h" - +#include "debug.h" static int last_y, last_x; static int last_btns; static long last_button_tick; @@ -44,7 +44,7 @@ static enum { * began or stopped the touch action + where (pixel coordinates) */ JNIEXPORT void JNICALL Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this, - bool down, int x, int y) + jboolean down, jint x, jint y) { (void)env; (void)this; @@ -63,12 +63,23 @@ Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this, * generated by pressing/releasing them to a variable */ JNIEXPORT bool JNICALL Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jobject this, - int keycode, bool state) + jint keycode, jboolean state) { (void)env; (void)this; - int button = key_to_button(keycode); + unsigned button = 0; + + if (!state) + button = multimedia_to_button((int)keycode); + + if (button) + { /* multimeida buttons are handled differently */ + queue_post(&button_queue, button, 0); + return true; + } + + button = key_to_button(keycode); if (button == BUTTON_NONE) return false; |