diff options
author | Zephaniah E. Hull <warp@aehallh.com> | 2006-02-24 13:44:56 +0000 |
---|---|---|
committer | Zephaniah E. Hull <warp@aehallh.com> | 2006-02-24 13:44:56 +0000 |
commit | 47482dad76ab74c0b5c9e8d455f04935651173ec (patch) | |
tree | 22818646846473ac8826d724fab4a297ac35e541 /src/evdev_key.c | |
parent | include errno.h to make it compile. (diff) | |
download | xf86-input-evdev-47482dad76ab74c0b5c9e8d455f04935651173ec.tar.gz xf86-input-evdev-47482dad76ab74c0b5c9e8d455f04935651173ec.tar.bz2 xf86-input-evdev-47482dad76ab74c0b5c9e8d455f04935651173ec.zip |
Compile with -Wall now. Add evdev.h to the sources so that make distcheck
gets it.
Bugzilla #5943 <https://bugs.freedesktop.org/show_bug.cgi=5943> Make sure
we include errno.h.
Reduce EVDEV_MAXBUTTONS to 96.
Split up evdevStateRec into a struct with pointers to new structs for btn,
abs, rel, and key.
New structure type for handling the device capability bitmaps.
Add device bits and struct input_id to evdevDeviceRec.
Add matching device bits, struct input_id, and pass number to
evdevDriverRec.
Prototype for evdevGetBits from evdev_brain.c.
Conversion for the evdevStateRec split.
Remove the errno.h include, it's in evdev.h for now.
Move the bit getting from the drivers to here, into evdevDeviceRec.
Fix a rare case of fd leakage.
Add several new (and somewhat ugly) device matching options: <map>Bits:
Where map is one of ev, key, rel, abs, msc, led, snd, or ff. In the
format of '+0 +3 -1-2 ~5-10', requires bits 0 and 3 be set, bits 1 and
2 to not be set, and at least one bit in the range of 5 to
10 be set. bustype, vendor, product, and version: Simple integer options
for matching the struct device_id fields, must be 0 (the default) or
the exact value you wish to match against. pass: Bounded to 0-3,
devices are matched to the first matching entry found, order for
multiple matching entries in the same pass is undefined, but it starts
with pass 0 and goes to pass 3.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
Add evdevGetBits to fill the new evdevBitsRec struct type.
Lots of somewhat ugly code for matching by capability bits.
Split out of evdevRescanDevices to smaller handling functions. The new
design should be better if I decide to handle arbitrary Device fields
again.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
Handle all buttons, no button compression at this time, however we reorder
things so that BTN_MOUSE comes before BTN_MISC, somewhat evily.
Support for the new btn->state[] array of int pointers.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
Adaptation for the evdevStateRec split and the change in capability bitmap
handling.
I really hope I didn't miss any changes.
Diffstat (limited to 'src/evdev_key.c')
-rw-r--r-- | src/evdev_key.c | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/src/evdev_key.c b/src/evdev_key.c index a759f5f..6e80602 100644 --- a/src/evdev_key.c +++ b/src/evdev_key.c @@ -328,10 +328,11 @@ EvdevKeyInit (DeviceIntPtr device) keySyms.maxKeyCode = MIN_KEYCODE + ArrayLength(map) / GLYPHS_PER_KEY - 1; - XkbSetRulesDflts (state->xkb_rules, state->xkb_model, state->xkb_layout, - state->xkb_variant, state->xkb_options); + XkbSetRulesDflts (state->key->xkb_rules, state->key->xkb_model, + state->key->xkb_layout, state->key->xkb_variant, + state->key->xkb_options); - XkbInitKeyboardDeviceStruct (device, &state->xkbnames, &keySyms, modMap, + XkbInitKeyboardDeviceStruct (device, &state->key->xkbnames, &keySyms, modMap, EvdevKbdBell, EvdevKbdCtrl); return Success; @@ -348,7 +349,6 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char *value, char **option) *option = NULL; } else { *option = s; - xf86Msg(X_CONFIG, "%s: %s: \"%s\"\n", pInfo->name, name, s); } } } @@ -358,44 +358,39 @@ EvdevKeyNew (InputInfoPtr pInfo) { evdevDevicePtr pEvdev = pInfo->private; evdevStatePtr state = &pEvdev->state; - long key_bitmask[NBITS(KEY_MAX)]; - int i; - - if (ioctl(pInfo->fd, - EVIOCGBIT(EV_KEY, sizeof(key_bitmask)), key_bitmask) < 0) { - xf86Msg(X_ERROR, "ioctl EVIOCGBIT failed: %s\n", strerror(errno)); - return !Success; - } + int i, keys = 0; for (i = 0; i <= KEY_UNKNOWN; i++) - if (TestBit (i, key_bitmask)) { - state->keys = 1; + if (TestBit (i, pEvdev->bits.key)) { + keys = 1; break; } - if (!state->keys) + if (!keys) return !Success; + state->key = Xcalloc (sizeof (evdevKeyRec)); + pInfo->type_name = XI_KEYBOARD; pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED; - SetXkbOption (pInfo, "XkbKeymap", NULL, &state->xkbnames.keymap); - if (state->xkbnames.keymap) { + SetXkbOption (pInfo, "XkbKeymap", NULL, &state->key->xkbnames.keymap); + if (state->key->xkbnames.keymap) { xf86Msg(X_CONFIG, "%s: XkbKeymap overrides all other XKB settings\n", pInfo->name); } else { - SetXkbOption (pInfo, "XkbRules", __XKBDEFRULES__, &state->xkb_rules); - SetXkbOption (pInfo, "XkbModel", "evdev", &state->xkb_model); - SetXkbOption (pInfo, "XkbLayout", "us", &state->xkb_layout); - SetXkbOption (pInfo, "XkbVariant", NULL, &state->xkb_variant); - SetXkbOption (pInfo, "XkbOptions", NULL, &state->xkb_options); - - SetXkbOption (pInfo, "XkbKeycodes", NULL, &state->xkbnames.keycodes); - SetXkbOption (pInfo, "XkbTypes", NULL, &state->xkbnames.types); - SetXkbOption (pInfo, "XkbCompat", NULL, &state->xkbnames.compat); - SetXkbOption (pInfo, "XkbSymbols", NULL, &state->xkbnames.symbols); - SetXkbOption (pInfo, "XkbGeometry", NULL, &state->xkbnames.geometry); + SetXkbOption (pInfo, "XkbRules", __XKBDEFRULES__, &state->key->xkb_rules); + SetXkbOption (pInfo, "XkbModel", "evdev", &state->key->xkb_model); + SetXkbOption (pInfo, "XkbLayout", "us", &state->key->xkb_layout); + SetXkbOption (pInfo, "XkbVariant", NULL, &state->key->xkb_variant); + SetXkbOption (pInfo, "XkbOptions", NULL, &state->key->xkb_options); + + SetXkbOption (pInfo, "XkbKeycodes", NULL, &state->key->xkbnames.keycodes); + SetXkbOption (pInfo, "XkbTypes", NULL, &state->key->xkbnames.types); + SetXkbOption (pInfo, "XkbCompat", NULL, &state->key->xkbnames.compat); + SetXkbOption (pInfo, "XkbSymbols", NULL, &state->key->xkbnames.symbols); + SetXkbOption (pInfo, "XkbGeometry", NULL, &state->key->xkbnames.geometry); } return Success; |