summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9b87077)
otherwise if device is missing, but it's config is loaded,
binds get messed up
static int *in_alloc_binds(int drv_id, int key_count)
{
const struct in_default_bind *defbinds;
static int *in_alloc_binds(int drv_id, int key_count)
{
const struct in_default_bind *defbinds;
int i;
binds = calloc(key_count * IN_BINDTYPE_COUNT * 2, sizeof(binds[0]));
if (binds == NULL)
return NULL;
int i;
binds = calloc(key_count * IN_BINDTYPE_COUNT * 2, sizeof(binds[0]));
if (binds == NULL)
return NULL;
+ binds_d = binds + key_count * IN_BINDTYPE_COUNT;
+
+ /* always have a copy of defbinds */
defbinds = DRV(drv_id).defbinds;
if (defbinds != NULL) {
for (i = 0; ; i++) {
if (defbinds[i].bit == 0 && defbinds[i].btype == 0
&& defbinds[i].bit == 0)
break;
defbinds = DRV(drv_id).defbinds;
if (defbinds != NULL) {
for (i = 0; ; i++) {
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_d[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] |=
-
- /* always have a copy of defbinds */
- memcpy(binds + key_count * IN_BINDTYPE_COUNT, binds,
- sizeof(binds[0]) * key_count * IN_BINDTYPE_COUNT);
+ memcpy(binds, binds + key_count * IN_BINDTYPE_COUNT,
+ sizeof(binds[0]) * key_count * IN_BINDTYPE_COUNT);
+
in_devices[i].name = tmp;
in_devices[i].binds = binds;
in_devices[i].key_count = key_count;
in_devices[i].name = tmp;
in_devices[i].binds = binds;
in_devices[i].key_count = key_count;
in_dev_t *dev = get_dev(dev_id);
if (dev == NULL)
return NULL;
in_dev_t *dev = get_dev(dev_id);
if (dev == NULL)
return NULL;
+ if (dev->binds == NULL)
+ return NULL;
return dev->binds + dev->key_count * IN_BINDTYPE_COUNT;
}
return dev->binds + dev->key_count * IN_BINDTYPE_COUNT;
}
- lprintf("input: missing driver for %s\n", name);
+ lprintf("input: missing driver for '%s'\n", name);
for (i = 0; i < IN_MAX_DEVS; i++)
if (in_devices[i].name == NULL) break;
if (i >= IN_MAX_DEVS) {
for (i = 0; i < IN_MAX_DEVS; i++)
if (in_devices[i].name == NULL) break;
if (i >= IN_MAX_DEVS) {
- lprintf("input: too many devices, can't add %s\n", name);
+ lprintf("input: too many devices, can't add '%s'\n",
+ name);
}
if (kc < 0 || kc >= dev->key_count) {
}
if (kc < 0 || kc >= dev->key_count) {
- lprintf("input: bad key: %s\n", key);
+ lprintf("input: bad key: '%s' for device '%s'\n",
+ key, dev->name);
in_dev_t *d = &in_devices[i];
if (!d->probed && d->name == NULL && d->binds == NULL)
continue;
in_dev_t *d = &in_devices[i];
if (!d->probed && d->name == NULL && d->binds == NULL)
continue;
- lprintf("%d %3d %6c %5c %s\n", i, d->drv_id, d->probed ? 'y' : 'n',
+ lprintf("%d %3d %6c %5c %s\n", i, d->drv_id,
+ d->probed ? 'y' : 'n',
d->binds ? 'y' : 'n', d->name);
d->binds ? 'y' : 'n', d->name);
+#if 0
+ if (d->binds) {
+ int kc, o, t, h;
+ for (kc = 0; kc < d->key_count; kc++) {
+ o = IN_BIND_OFFS(kc, 0);
+ for (t = h = 0; t < IN_BINDTYPE_COUNT; t++)
+ h |= d->binds[o + t];
+ if (h == 0)
+ continue;
+ lprintf(" [%3d] =", kc);
+ for (t = 0; t < IN_BINDTYPE_COUNT; t++)
+ printf(" %x", d->binds[o + t]);
+ printf("\n");
+ }
+ }
+#endif
in_unbind_all(bind_dev_id, opts[sel].mask << mask_shift, bindtype);\r
\r
in_bind_key(bind_dev_id, kc, opts[sel].mask << mask_shift, bindtype, 0);\r
in_unbind_all(bind_dev_id, opts[sel].mask << mask_shift, bindtype);\r
\r
in_bind_key(bind_dev_id, kc, opts[sel].mask << mask_shift, bindtype, 0);\r
+\r
+ // make sure bind change is displayed\r
+ if (dev_id != -1)\r
+ dev_id = bind_dev_id;\r