summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/button-android.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-02-23 01:10:54 +0000
committerThomas Martitz <kugel@rockbox.org>2011-02-23 01:10:54 +0000
commit95e24dd7a54256e8df56e347c0f43133087a1df2 (patch)
tree677d66d4e72fedfe134bca103ed98b5792da1440 /firmware/target/hosted/android/button-android.c
parentda3417706d927c7da0b59351fa8cc010d63d7928 (diff)
downloadrockbox-95e24dd7a54256e8df56e347c0f43133087a1df2.tar.gz
rockbox-95e24dd7a54256e8df56e347c0f43133087a1df2.zip
Android:
* Re-create RockboxFramebuffer instance with every time there's a new Activity. * Also, allow Rockbox to be started via multimedia buttons, immediately starting playback if wanted. We don't need to keep the fb instance around when it backround, and it makes us less depending on it and the activity (less race conditions). And this is how you usually do it in Android apps. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29384 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/hosted/android/button-android.c')
-rw-r--r--firmware/target/hosted/android/button-android.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/firmware/target/hosted/android/button-android.c b/firmware/target/hosted/android/button-android.c
index 832eef54f3..ed1e125223 100644
--- a/firmware/target/hosted/android/button-android.c
+++ b/firmware/target/hosted/android/button-android.c
@@ -29,6 +29,7 @@
29#include "system.h" 29#include "system.h"
30#include "touchscreen.h" 30#include "touchscreen.h"
31 31
32extern JNIEnv *env_ptr;
32static int last_y, last_x; 33static int last_y, last_x;
33static int last_btns; 34static int last_btns;
34 35
@@ -61,11 +62,11 @@ Java_org_rockbox_RockboxFramebuffer_touchHandler(JNIEnv*env, jobject this,
61 * this writes in an interrupt-like fashion the button events that the user 62 * this writes in an interrupt-like fashion the button events that the user
62 * generated by pressing/releasing them to a variable */ 63 * generated by pressing/releasing them to a variable */
63JNIEXPORT bool JNICALL 64JNIEXPORT bool JNICALL
64Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jclass this, 65Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jclass class,
65 jint keycode, jboolean state) 66 jint keycode, jboolean state)
66{ 67{
67 (void)env; 68 (void)env;
68 (void)this; 69 (void)class;
69 70
70 unsigned button = 0; 71 unsigned button = 0;
71 72
@@ -75,7 +76,10 @@ Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jclass this,
75 if (!button) 76 if (!button)
76 button = dpad_to_button((int)keycode); 77 button = dpad_to_button((int)keycode);
77 if (button) 78 if (button)
79 {
78 queue_post(&button_queue, button, 0); 80 queue_post(&button_queue, button, 0);
81 return true;
82 }
79 } 83 }
80 84
81 if (!button) 85 if (!button)