summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-08-14 09:05:40 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-08-14 10:15:00 +1000
commit7967677789e3ee24733b3514e1ae7a8e12bbc2b5 (patch)
tree01d324133b43907a602ed76f9d1d95c907d73244
parent36064dca9097df896b4b1b49c9c68775f1728846 (diff)
Treat tablets (BTN_TOOL_PEN devices) differently from touchpads.
The previous checks for BTN_TOOL_FINGER and BTN_TOUCH reported false positives for touchpads for most popular tablets. As a result, their events were converted to relative events. Add a new flag EVDEV_TABLET pending presence of BTN_TOOL_PEN and ignore the touchpad special casing to report the events as-is. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 9c3a990..98f2f1b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -89,6 +89,7 @@
#define EVDEV_INITIALIZED (1 << 5) /* WheelInit etc. called already? */
#define EVDEV_TOUCHSCREEN (1 << 6)
#define EVDEV_CALIBRATED (1 << 7) /* run-time calibrated? */
+#define EVDEV_TABLET (1 << 8) /* run-time calibrated? */
#define MIN_KEYCODE 8
#define GLYPHS_PER_KEY 2
@@ -1469,8 +1470,8 @@ EvdevInitTouchDevice(DeviceIntPtr device, EvdevPtr pEvdev)
{
if (pEvdev->flags & EVDEV_RELATIVE_EVENTS) {
- xf86Msg(X_WARNING,"%s: touchpads and touchscreens ignore relative "
- "axes.\n", device->name);
+ xf86Msg(X_WARNING,"%s: touchpads, tablets and touchscreens ignore "
+ "relative axes.\n", device->name);
pEvdev->flags &= ~EVDEV_RELATIVE_EVENTS;
}
@@ -1511,7 +1512,7 @@ EvdevInit(DeviceIntPtr device)
* used and relative axes are ignored.
*/
- if (pEvdev->flags & (EVDEV_TOUCHPAD | EVDEV_TOUCHSCREEN))
+ if (pEvdev->flags & (EVDEV_TOUCHPAD | EVDEV_TOUCHSCREEN | EVDEV_TABLET))
EvdevInitTouchDevice(device, pEvdev);
else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
EvdevInitRelClass(device, pEvdev);
@@ -1861,10 +1862,14 @@ EvdevProbe(InputInfoPtr pInfo)
if ((TestBit(ABS_X, pEvdev->abs_bitmask) &&
TestBit(ABS_Y, pEvdev->abs_bitmask))) {
xf86Msg(X_INFO, "%s: Found x and y absolute axes\n", pInfo->name);
- if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
+ if (TestBit(BTN_TOOL_PEN, pEvdev->key_bitmask))
+ {
+ xf86Msg(X_INFO, "%s: Found absolute tablet.\n", pInfo->name);
+ pEvdev->flags |= EVDEV_TABLET;
+ } else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
- xf86Msg(X_INFO, "%s: Found absolute touchpad or tablet.\n", pInfo->name);
+ xf86Msg(X_INFO, "%s: Found absolute touchpad.\n", pInfo->name);
pEvdev->flags |= EVDEV_TOUCHPAD;
memset(pEvdev->old_vals, -1, sizeof(int) * pEvdev->num_vals);
} else {
@@ -1892,7 +1897,7 @@ EvdevProbe(InputInfoPtr pInfo)
if (pEvdev->flags & EVDEV_TOUCHPAD) {
xf86Msg(X_INFO, "%s: Configuring as touchpad\n", pInfo->name);
pInfo->type_name = XI_TOUCHPAD;
- } else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask)) {
+ } else if (pEvdev->flags & EVDEV_TABLET) {
xf86Msg(X_INFO, "%s: Configuring as tablet\n", pInfo->name);
pInfo->type_name = XI_TABLET;
} else if (pEvdev->flags & EVDEV_TOUCHSCREEN) {