Does touchpads have buttons?
Søren Hauberg
hauberg at gmail.com
Mon Sep 29 07:20:25 PDT 2008
2008/9/29 Peter Hutterer <peter.hutterer at who-t.net>:
> 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.
Yes, this was just me putting my stupidity on display :-)
> 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.
Agreed.
> Also - maybe you can find a way to work around was_touched and use
> pEvdev->tool to indicate if a touch is active?
Yeah, I don't like introducing yet another variable either. I'll look
into doing this with pEvdev->tool instead.
> 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).
I tried only to break from the switch statement if we're not using a
touch screen. That way, BTN_TOUCH should be handled by the default
case if we're on a touch screen. This, however, seemed to kill the X
server. I haven't had the time to debug it.
> 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.
I don't have such hardware, so I can't be of much assistance here.
> + } 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?
This requires that I keep track of the position of the cursor manually
, right? pEvdev has old_x and old_y for this, so it's fairly easy to
do this.
>> 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.
Okay, I'm leaving the office in a few minutes anyway, so I'll check
things tomorrow.
Thanks,
Søren
More information about the xorg
mailing list