From b07c18e8645a17be916266820ae564e0d320cc1a Mon Sep 17 00:00:00 2001 From: notaz Date: Tue, 24 Apr 2012 01:48:17 +0300 Subject: frontend: input: pass default binds as argument allows to get rid of some hacks --- frontend/gp2x/in_gp2x.c | 17 ++--------------- frontend/gp2x/in_gp2x.h | 5 ++--- 2 files changed, 4 insertions(+), 18 deletions(-) (limited to 'frontend/gp2x') diff --git a/frontend/gp2x/in_gp2x.c b/frontend/gp2x/in_gp2x.c index b750e68..196f121 100644 --- a/frontend/gp2x/in_gp2x.c +++ b/frontend/gp2x/in_gp2x.c @@ -244,18 +244,6 @@ static const struct { }; #endif -static void in_gp2x_get_def_binds(int *binds) -{ - int i; - - for (i = 0; 1; i++) { - if (in_gp2x_defbinds[i].bit == 0 && in_gp2x_defbinds[i].code == 0) - break; - binds[IN_BIND_OFFS(in_gp2x_defbinds[i].code, in_gp2x_defbinds[i].btype)] = - 1 << in_gp2x_defbinds[i].bit; - } -} - /* remove binds of missing keys, count remaining ones */ static int in_gp2x_clean_binds(void *drv_data, int *binds, int *def_binds) { @@ -305,20 +293,19 @@ static const in_drv_t in_gp2x_drv = { .probe = in_gp2x_probe, .free = in_gp2x_free, .get_key_names = in_gp2x_get_key_names, - .get_def_binds = in_gp2x_get_def_binds, .clean_binds = in_gp2x_clean_binds, .update = in_gp2x_update, .update_keycode = in_gp2x_update_keycode, .menu_translate = in_gp2x_menu_translate, }; -void in_gp2x_init(void) +void in_gp2x_init(const struct in_default_bind *defbinds) { if (gp2x_dev_id == GP2X_DEV_WIZ) in_gp2x_keys[GP2X_BTN_START] = "MENU"; in_gp2x_combo_keys = in_gp2x_combo_acts = 0; - in_register_driver(&in_gp2x_drv); + in_register_driver(&in_gp2x_drv, defbinds); } diff --git a/frontend/gp2x/in_gp2x.h b/frontend/gp2x/in_gp2x.h index 6428a63..035cded 100644 --- a/frontend/gp2x/in_gp2x.h +++ b/frontend/gp2x/in_gp2x.h @@ -1,8 +1,7 @@ -void in_gp2x_init(void); +struct in_default_bind; -/* to be set somewhere in platform code */ -extern struct in_default_bind in_gp2x_defbinds[]; +void in_gp2x_init(const struct in_default_bind *defbinds); enum { GP2X_BTN_UP = 0, GP2X_BTN_LEFT = 2, GP2X_BTN_DOWN = 4, GP2X_BTN_RIGHT = 6, GP2X_BTN_START = 8, GP2X_BTN_SELECT = 9, GP2X_BTN_L = 10, GP2X_BTN_R = 11, -- cgit v1.2.3