summaryrefslogtreecommitdiff
path: root/firmware/target/hosted
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r--firmware/target/hosted/android/app/button-application.c21
-rw-r--r--firmware/target/hosted/android/app/button-target.h1
-rw-r--r--firmware/target/hosted/android/button-android.c19
3 files changed, 37 insertions, 4 deletions
diff --git a/firmware/target/hosted/android/app/button-application.c b/firmware/target/hosted/android/app/button-application.c
index 47798a6096..a7d75ef172 100644
--- a/firmware/target/hosted/android/app/button-application.c
+++ b/firmware/target/hosted/android/app/button-application.c
@@ -45,3 +45,24 @@ int key_to_button(int keyboard_key)
45 return BUTTON_MENU; 45 return BUTTON_MENU;
46 } 46 }
47} 47}
48
49unsigned multimedia_to_button(int keyboard_key)
50{
51 switch (keyboard_key)
52 {
53 case KEYCODE_MEDIA_PLAY_PAUSE:
54 return BUTTON_MULTIMEDIA_PLAYPAUSE;
55 case KEYCODE_MEDIA_STOP:
56 return BUTTON_MULTIMEDIA_STOP;
57 case KEYCODE_MEDIA_NEXT:
58 return BUTTON_MULTIMEDIA_NEXT;
59 case KEYCODE_MEDIA_PREVIOUS:
60 return BUTTON_MULTIMEDIA_PREV;
61 case KEYCODE_MEDIA_REWIND:
62 return BUTTON_MULTIMEDIA_REW;
63 case KEYCODE_MEDIA_FAST_FORWARD:
64 return BUTTON_MULTIMEDIA_FFWD;
65 default:
66 return 0;
67 }
68}
diff --git a/firmware/target/hosted/android/app/button-target.h b/firmware/target/hosted/android/app/button-target.h
index 6c7bd271e9..ca306d4fef 100644
--- a/firmware/target/hosted/android/app/button-target.h
+++ b/firmware/target/hosted/android/app/button-target.h
@@ -28,6 +28,7 @@
28#undef button_init_device 28#undef button_init_device
29void button_init_device(void); 29void button_init_device(void);
30int button_read_device(int *data); 30int button_read_device(int *data);
31unsigned multimedia_to_button(int keyboard_key);
31 32
32/* Main unit's buttons */ 33/* Main unit's buttons */
33#define BUTTON_MENU 0x00000001 34#define BUTTON_MENU 0x00000001
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;