forked from len0rd/rockbox
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
This commit is contained in:
parent
45fa8245ea
commit
a41041aeb4
5 changed files with 75 additions and 55 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue