[PATCH:evdev] Fix up BTN_TOUCH handling for non-button tablets.

Peter Hutterer peter.hutterer at who-t.net
Tue Dec 1 15:39:44 PST 2009


BTN_TOOL_* is treated as tool, just like before. BTN_TOUCH on the other hand
may need to be treated as a button left press. This again requires a button
class.

Tested on an HP Touchsmart and a Wacom tablet.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 85503bf..17c0f01 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -552,7 +552,6 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
             return;
 
     switch (ev->code) {
-        case BTN_TOUCH:
         case BTN_TOOL_PEN:
         case BTN_TOOL_RUBBER:
         case BTN_TOOL_BRUSH:
@@ -562,7 +561,11 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
         case BTN_TOOL_MOUSE:
         case BTN_TOOL_LENS:
             pEvdev->tool = value ? ev->code : 0;
-            if (!(pEvdev->flags & EVDEV_TOUCHSCREEN))
+            break;
+
+        case BTN_TOUCH:
+            pEvdev->tool = value ? ev->code : 0;
+            if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)))
                 break;
             /* Treat BTN_TOUCH from devices that only have BTN_TOUCH as
              * BTN_LEFT. */
@@ -1844,6 +1847,11 @@ EvdevProbe(InputInfoPtr pInfo)
             {
                 xf86Msg(X_INFO, "%s: Found absolute tablet.\n", pInfo->name);
                 pEvdev->flags |= EVDEV_TABLET;
+                if (!pEvdev->num_buttons)
+                {
+                    pEvdev->num_buttons = 7; /* LMR + scroll wheels */
+                    pEvdev->flags |= EVDEV_BUTTON_EVENTS;
+                }
             } else if (TestBit(ABS_PRESSURE, pEvdev->abs_bitmask) ||
                 TestBit(BTN_TOUCH, pEvdev->key_bitmask)) {
                 if (num_buttons || TestBit(BTN_TOOL_FINGER, pEvdev->key_bitmask)) {
-- 
1.6.5.2


More information about the xorg-devel mailing list