From: Anisse Astier Date: Wed, 18 Aug 2010 11:01:08 +0200 Subject: [PATCH] Fix tap on certain touchscreens by ignoring BTN_TOOL_PEN as a tool Some touchscreens report all kind of events and evdev driver cannot tell them apart from a tablet or touchpad. Hence, the tool will be set/unset and a tap might be ignored because of the special treatment for wacom tablets. In this patch we don't count BTN_TOOL_PEN as a tool if BTN_TOUCH is available for this device. Signed-off-by: Anisse Astier --- src/evdev.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index a609028..1bc446d 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -598,6 +598,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev) else pEvdev->abs |= ABS_VALUE; } +#define TestBit(bit, array) ((array[(bit) / LONG_BITS]) & (1L << ((bit) % LONG_BITS))) /** * Take the key press/release input event and process it accordingly. @@ -618,6 +619,17 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev) switch (ev->code) { case BTN_TOOL_PEN: + /* + * Some touchscreens report all kind of events and evdev driver cannot + * tell them apart from a tablet or touchpad. + * Hence, the tool will be set/unset and a tap might be ignored in because + * of the special treatment for (wacom) tablets in + * EvdevPostAbsoluteMotionEvents and EvdevProcessValuators. + */ + if (TestBit(BTN_TOUCH, pEvdev->key_bitmask)) + break; + /* Intentional fallthrough! */ + case BTN_TOOL_RUBBER: case BTN_TOOL_BRUSH: case BTN_TOOL_PENCIL: @@ -804,7 +816,6 @@ EvdevReadInput(InputInfoPtr pInfo) } } -#define TestBit(bit, array) ((array[(bit) / LONG_BITS]) & (1L << ((bit) % LONG_BITS))) static void EvdevPtrCtrlProc(DeviceIntPtr device, PtrCtrl *ctrl) -- 1.7.0.6