From a41041aeb431c259dc79a203821e81b00c63ebe9 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Wed, 3 Nov 2010 14:34:57 +0000 Subject: 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 --- firmware/target/hosted/android/button-android.c | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'firmware/target/hosted/android/button-android.c') 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, 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; + if (!button) + button = dpad_to_button((int)keycode); + if (button) + queue_post(&button_queue, button, 0); } - button = key_to_button(keycode); + if (!button) + { + button = key_to_button(keycode); + } if (button == BUTTON_NONE) + { + last_btns = button; return false; + } if (state) { last_btns |= button; - last_button_tick = current_tick; } + else + { + last_btns &= (~button); + return false; + } + return true; } void button_init_device(void) { - last_button_tick = 0; } int button_read_device(int *data) @@ -110,7 +120,5 @@ int button_read_device(int *data) if (last_touch_state == STATE_DOWN) btn |= touch; - if (TIME_AFTER(current_tick, last_button_tick+5)) - last_btns = 0; return btn; } -- cgit v1.2.3