Does touchpads have buttons?

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 29 06:20:16 PDT 2008


Søren:

On Mon, Sep 29, 2008 at 01:29:35PM +0200, Søren Hauberg wrote:
> > Sorry, I wanted to suggest that in reply but missed it. Anyway, be aware
> > that as your patch is now, you're also triggering on absolute axes you can't
> > handle/don't know. I'd consider that a regression.
> 
> Ahh, I (think I) see. The attached patch should handle this. 

a few comments to your patch:

@@ -208,14 +224,23 @@
             break;
 
 	case EV_ABS:
+            abs = 1;

this is the problem here. You may be defining abs even if we don't have
absolute x/y axes. Just leave that bit as it is.

  	    case BTN_TOOL_FINGER:
  	    case BTN_TOOL_MOUSE:
  	    case BTN_TOOL_LENS:
+ 	        was_touched = 1;
 		pEvdev->tool = value ? ev.code : 0;
 		break;

why set was_touched for BTN_TOOL_LENS, etc? It'd be better to move this line
up to BTN_TOUCH.
Also - maybe you can find a way to work around was_touched and use
pEvdev->tool to indicate if a touch is active?
Or - even better, you hook into the default case of the switch statement for
BTN_TOUCH and let the already existing code handle buttons, draglock, etc.
(right now you're missing out on this).
Not 100% sure myself if devices like wacom send BTN_TOUCH and if that would
then interfere with your code. Something to look at I guess.

+    } else if (pEvdev->flags & EVDEV_TOUCHSCREEN) {
+        if (was_touched) {
+            xf86PostMotionEvent(pInfo->dev, TRUE, 0, 2,
+			        pEvdev->abs_x, pEvdev->abs_y);

Maybe only send a motion event when the coordinates actually have changed?

>   Also, I've hardcoded my own calibration parameters into the patch to
> ease testing. This is obviously not usable in general. If I want to
> use device properties (that's what I've been told they're called) to
> set these parameters, how would I go about doing that?

evdev already has the code for device properties in e.g. draglock.c. Best to
just check it but maybe wait a day or so, I have changes in the pipe that
restructure the use of DP in evdev. The API is the same, but the handler
registration is a bit different.

Cheers,
  Peter



More information about the xorg mailing list