notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add gitignore, gitsubmodules
[picodrive.git]
/
platform
/
linux
/
in_evdev.c
diff --git
a/platform/linux/in_evdev.c
b/platform/linux/in_evdev.c
index
23d2e2a
..
b447da1
100644
(file)
--- a/
platform/linux/in_evdev.c
+++ b/
platform/linux/in_evdev.c
@@
-559,9
+559,10
@@
static const struct {
#define KEY_PBTN_MAP_SIZE (sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]))
#define KEY_PBTN_MAP_SIZE (sizeof(key_pbtn_map) / sizeof(key_pbtn_map[0]))
-static int in_evdev_menu_translate(void *drv_data, int keycode)
+static int in_evdev_menu_translate(void *drv_data, int keycode
, char *charcode
)
{
in_evdev_t *dev = drv_data;
{
in_evdev_t *dev = drv_data;
+ int ret = 0;
int i;
if (keycode < 0)
int i;
if (keycode < 0)
@@
-578,24
+579,25
@@
static int in_evdev_menu_translate(void *drv_data, int keycode)
}
else
{
}
else
{
- for (i = 0; i < KEY_PBTN_MAP_SIZE; i++)
- if (key_pbtn_map[i].key == keycode)
- return key_pbtn_map[i].pbtn;
- }
-
- return 0;
-}
-
-static void in_evdev_get_def_binds(int *binds)
-{
- int i;
+ for (i = 0; i < KEY_PBTN_MAP_SIZE; i++) {
+ if (key_pbtn_map[i].key == keycode) {
+ ret = key_pbtn_map[i].pbtn;
+ break;
+ }
+ }
- for (i = 0; ; i++) {
- if (in_evdev_defbinds[i].bit == 0 && in_evdev_defbinds[i].code == 0)
- break;
- binds[IN_BIND_OFFS(in_evdev_defbinds[i].code, in_evdev_defbinds[i].btype)] =
- 1 << in_evdev_defbinds[i].bit;
+ if (charcode != NULL && (unsigned int)keycode < KEY_CNT &&
+ in_evdev_keys[keycode] != NULL && in_evdev_keys[keycode][1] == 0)
+ {
+ char c = in_evdev_keys[keycode][0];
+ if ('A' <= c && c <= 'Z')
+ c = 'a' + c - 'A';
+ ret |= PBTN_CHAR;
+ *charcode = c;
+ }
}
}
+
+ return ret;
}
/* remove binds of missing keys, count remaining ones */
}
/* remove binds of missing keys, count remaining ones */
@@
-637,7
+639,6
@@
static const in_drv_t in_evdev_drv = {
.probe = in_evdev_probe,
.free = in_evdev_free,
.get_key_names = in_evdev_get_key_names,
.probe = in_evdev_probe,
.free = in_evdev_free,
.get_key_names = in_evdev_get_key_names,
- .get_def_binds = in_evdev_get_def_binds,
.clean_binds = in_evdev_clean_binds,
.get_config = in_evdev_get_config,
.set_config = in_evdev_set_config,
.clean_binds = in_evdev_clean_binds,
.get_config = in_evdev_get_config,
.set_config = in_evdev_set_config,
@@
-647,8
+648,8
@@
static const in_drv_t in_evdev_drv = {
.menu_translate = in_evdev_menu_translate,
};
.menu_translate = in_evdev_menu_translate,
};
-void in_evdev_init(
void
)
+void in_evdev_init(
const struct in_default_bind *defbinds
)
{
{
- in_register_driver(&in_evdev_drv);
+ in_register_driver(&in_evdev_drv
, defbinds
);
}
}