X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=input.c;h=2c34a7974fe69378edc2d32ee124271c929594aa;hb=87dc66a0252fe3a19ca10db73d495724a2193e71;hp=12654e4168578ef521ec82bd0784ad45750b631b;hpb=a4025790b5eded4501bb659c682004202880a76b;p=libpicofe.git diff --git a/input.c b/input.c index 12654e4..2c34a79 100644 --- a/input.c +++ b/input.c @@ -60,9 +60,10 @@ static int *in_alloc_binds(int drv_id, int key_count) defbinds = DRV(drv_id).defbinds; if (defbinds != NULL) { for (i = 0; ; i++) { - if (defbinds[i].bit == 0 && defbinds[i].code == 0) + if (defbinds[i].bit == 0 && defbinds[i].btype == 0 + && defbinds[i].bit == 0) break; - binds[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] = + binds[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] |= 1 << defbinds[i].bit; } @@ -246,7 +247,7 @@ void in_probe(void) for (i = 0; i < in_driver_count; i++) { in_probe_dev_id = i; - in_drivers[i].probe(); + in_drivers[i].probe(&DRV(i)); } /* get rid of devs without binds and probes */ @@ -427,6 +428,7 @@ finish: int in_menu_wait_any(char *charcode, int timeout_ms) { int keys_old = menu_key_state; + int ret; while (1) { @@ -442,7 +444,9 @@ int in_menu_wait_any(char *charcode, int timeout_ms) } } - return menu_key_state; + ret = menu_key_state; + menu_key_state &= ~PBTN_CHAR; + return ret; } /* wait for menu input, do autorepeat */ @@ -804,7 +808,8 @@ int in_config_parse_dev(const char *name) if (in_devices[i].name == NULL) return -1; - in_devices[i].key_names = DRV(drv_id).get_key_names(&in_devices[i].key_count); + in_devices[i].key_names = DRV(drv_id).get_key_names(&DRV(drv_id), + &in_devices[i].key_count); in_devices[i].drv_id = drv_id; if (i + 1 > in_dev_count) @@ -928,7 +933,8 @@ static const char *in_def_get_key_name(int keycode) { return NULL; } if (d.f == NULL) d.f = in_def_##f /* to be called by drivers */ -int in_register_driver(const in_drv_t *drv, const struct in_default_bind *defbinds) +int in_register_driver(const in_drv_t *drv, + const struct in_default_bind *defbinds, const void *pdata) { int count_new = in_driver_count + 1; in_drv_t *new_drivers; @@ -950,7 +956,9 @@ int in_register_driver(const in_drv_t *drv, const struct in_default_bind *defbin CHECK_ADD_STUB(new_drivers[in_driver_count], menu_translate); CHECK_ADD_STUB(new_drivers[in_driver_count], get_key_code); CHECK_ADD_STUB(new_drivers[in_driver_count], get_key_name); - if (defbinds != NULL) + if (pdata) + new_drivers[in_driver_count].pdata = pdata; + if (defbinds) new_drivers[in_driver_count].defbinds = defbinds; in_drivers = new_drivers; in_driver_count = count_new;