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
|
@ -23,26 +23,24 @@
|
|||
#include "button.h"
|
||||
#include "android_keyevents.h"
|
||||
|
||||
static bool ignore_back_button = false;
|
||||
void android_ignore_back_button(bool yes)
|
||||
{
|
||||
ignore_back_button = yes;
|
||||
}
|
||||
|
||||
int key_to_button(int keyboard_key)
|
||||
{
|
||||
switch (keyboard_key)
|
||||
{
|
||||
default:
|
||||
return BUTTON_NONE;
|
||||
case KEYCODE_BACK:
|
||||
return BUTTON_BACK;
|
||||
case KEYCODE_DPAD_UP:
|
||||
return BUTTON_DPAD_UP;
|
||||
case KEYCODE_DPAD_DOWN:
|
||||
return BUTTON_DPAD_DOWN;
|
||||
case KEYCODE_DPAD_LEFT:
|
||||
return BUTTON_DPAD_LEFT;
|
||||
case KEYCODE_DPAD_RIGHT:
|
||||
return BUTTON_DPAD_RIGHT;
|
||||
case KEYCODE_DPAD_CENTER:
|
||||
return BUTTON_DPAD_CENTER;
|
||||
return ignore_back_button ? BUTTON_NONE : BUTTON_BACK;
|
||||
case KEYCODE_MENU:
|
||||
return BUTTON_MENU;
|
||||
case KEYCODE_DPAD_CENTER:
|
||||
return BUTTON_DPAD_CENTER;
|
||||
default:
|
||||
return BUTTON_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,3 +64,25 @@ unsigned multimedia_to_button(int keyboard_key)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned dpad_to_button(int keyboard_key)
|
||||
{
|
||||
switch (keyboard_key)
|
||||
{
|
||||
/* These buttons only post a single release event.
|
||||
* doing otherwise will cause action.c to lock up waiting for
|
||||
* a release (because android sends press/unpress to us too quickly
|
||||
*/
|
||||
case KEYCODE_DPAD_UP:
|
||||
return BUTTON_DPAD_UP|BUTTON_REL;
|
||||
case KEYCODE_DPAD_DOWN:
|
||||
return BUTTON_DPAD_DOWN|BUTTON_REL;
|
||||
case KEYCODE_DPAD_LEFT:
|
||||
return BUTTON_DPAD_LEFT|BUTTON_REL;
|
||||
case KEYCODE_DPAD_RIGHT:
|
||||
return BUTTON_DPAD_RIGHT|BUTTON_REL;
|
||||
default:
|
||||
return BUTTON_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue