diff --git a/src/evdev.c b/src/evdev.c index 25325a3..559f863 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -1043,8 +1043,6 @@ EvdevInit(DeviceIntPtr device) pInfo = device->public.devicePrivate; pEvdev = pInfo->private; - /* FIXME: This doesn't add buttons for keyboards with scrollwheels. */ - if (pEvdev->flags & EVDEV_KEYBOARD_EVENTS) EvdevAddKeyClass(device); if (pEvdev->flags & EVDEV_BUTTON_EVENTS) @@ -1303,7 +1301,7 @@ EvdevProbe(InputInfoPtr pInfo) long key_bitmask[NBITS(KEY_MAX)] = {0}; long rel_bitmask[NBITS(REL_MAX)] = {0}; long abs_bitmask[NBITS(ABS_MAX)] = {0}; - int i, has_axes, has_keys, num_buttons; + int i, has_axes, has_keys, num_buttons, has_scroll; int kernel24 = 0; EvdevPtr pEvdev = pInfo->private; @@ -1340,6 +1338,7 @@ EvdevProbe(InputInfoPtr pInfo) has_axes = FALSE; has_keys = FALSE; + has_scroll = FALSE; num_buttons = 0; /* count all buttons */ @@ -1362,6 +1361,11 @@ EvdevProbe(InputInfoPtr pInfo) pEvdev->flags |= EVDEV_RELATIVE_EVENTS; has_axes = TRUE; } + + if (TestBit(REL_WHEEL, rel_bitmask) || TestBit(REL_HWHEEL, rel_bitmask)) { + xf86Msg(X_INFO, "%s: Found scroll wheel(s)\n", pInfo->name); + has_scroll = TRUE; + } if (TestBit(ABS_X, abs_bitmask) && TestBit(ABS_Y, abs_bitmask)) { xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name); @@ -1410,8 +1414,17 @@ EvdevProbe(InputInfoPtr pInfo) pInfo->name); } else { xf86Msg(X_INFO, "%s: Configuring as keyboard\n", pInfo->name); - pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED; + + if (has_scroll) + { + xf86Msg(X_INFO, "%s: Adding scrollwheel support\n", pInfo->name); + pInfo->flags |= XI86_POINTER_CAPABLE; + pEvdev->flags |= EVDEV_BUTTON_EVENTS; + pEvdev->flags |= EVDEV_RELATIVE_EVENTS; + } + pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED; pInfo->type_name = XI_KEYBOARD; + } }