diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-11-03 14:34:57 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-11-03 14:34:57 +0000 |
commit | a41041aeb431c259dc79a203821e81b00c63ebe9 (patch) | |
tree | 63f42bc3a4141e52f9c7f37396fa20d1ab10e066 /firmware/target/hosted/android/button-android.c | |
parent | 45fa8245eaf3f8d8a2ff95eae7509a9d3af26c3d (diff) | |
download | rockbox-a41041aeb431c259dc79a203821e81b00c63ebe9.tar.gz rockbox-a41041aeb431c259dc79a203821e81b00c63ebe9.zip |
Remote android button handling (again). do the press/unpress more like other targets (i.e correctly). The DPAD is special in that the press/unpress happens too quickly, so always post it with the BUTTON_REL. This means all keymaps using the dpad need to remember it will always have a BUTTON_REL (which also means they cant do repeats, which are impossible anyway).
Also make the back button go back to the OS home from the rockbox main menu
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28475 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 | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/firmware/target/hosted/android/button-android.c b/firmware/target/hosted/android/button-android.c index 9bf15c25a2..26b6b1380e 100644 --- a/firmware/target/hosted/android/button-android.c +++ b/firmware/target/hosted/android/button-android.c | |||
@@ -71,30 +71,40 @@ Java_org_rockbox_RockboxFramebuffer_buttonHandler(JNIEnv*env, jobject this, | |||
71 | unsigned button = 0; | 71 | unsigned button = 0; |
72 | 72 | ||
73 | if (!state) | 73 | if (!state) |
74 | { | ||
74 | button = multimedia_to_button((int)keycode); | 75 | button = multimedia_to_button((int)keycode); |
75 | 76 | if (!button) | |
76 | if (button) | 77 | button = dpad_to_button((int)keycode); |
77 | { /* multimeida buttons are handled differently */ | 78 | if (button) |
78 | queue_post(&button_queue, button, 0); | 79 | queue_post(&button_queue, button, 0); |
79 | return true; | ||
80 | } | 80 | } |
81 | 81 | ||
82 | button = key_to_button(keycode); | 82 | if (!button) |
83 | { | ||
84 | button = key_to_button(keycode); | ||
85 | } | ||
83 | 86 | ||
84 | if (button == BUTTON_NONE) | 87 | if (button == BUTTON_NONE) |
88 | { | ||
89 | last_btns = button; | ||
85 | return false; | 90 | return false; |
91 | } | ||
86 | 92 | ||
87 | if (state) | 93 | if (state) |
88 | { | 94 | { |
89 | last_btns |= button; | 95 | last_btns |= button; |
90 | last_button_tick = current_tick; | ||
91 | } | 96 | } |
97 | else | ||
98 | { | ||
99 | last_btns &= (~button); | ||
100 | return false; | ||
101 | } | ||
102 | |||
92 | return true; | 103 | return true; |
93 | } | 104 | } |
94 | 105 | ||
95 | void button_init_device(void) | 106 | void button_init_device(void) |
96 | { | 107 | { |
97 | last_button_tick = 0; | ||
98 | } | 108 | } |
99 | 109 | ||
100 | int button_read_device(int *data) | 110 | int button_read_device(int *data) |
@@ -110,7 +120,5 @@ int button_read_device(int *data) | |||
110 | if (last_touch_state == STATE_DOWN) | 120 | if (last_touch_state == STATE_DOWN) |
111 | btn |= touch; | 121 | btn |= touch; |
112 | 122 | ||
113 | if (TIME_AFTER(current_tick, last_button_tick+5)) | ||
114 | last_btns = 0; | ||
115 | return btn; | 123 | return btn; |
116 | } | 124 | } |