The current implementation assume that multitouch devices following the Multitouch Protocol A (those requiring mtdev) present 10 touches, no matter mtdev decides. num_slots should be relying on mtdev when it is available.
Signed-off-by: Benjamin Tissoires <[email protected]> --- src/evdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/evdev.c b/src/evdev.c index 27b0e76..93758fd 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -755,8 +755,14 @@ EvdevProcessTouch(InputInfoPtr pInfo) static int num_slots(EvdevPtr pEvdev) { - int value = pEvdev->absinfo[ABS_MT_SLOT].maximum - + int value = 0; + + if (!pEvdev->mtdev) + value = pEvdev->absinfo[ABS_MT_SLOT].maximum - pEvdev->absinfo[ABS_MT_SLOT].minimum + 1; + else if (pEvdev->mtdev->caps.slot.maximum > 0) + value = pEvdev->mtdev->caps.slot.maximum - + pEvdev->mtdev->caps.slot.minimum + 1; /* If we don't know how many slots there are, assume at least 10 */ return value > 1 ? value : 10; @@ -1385,14 +1391,10 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device) #ifdef MULTITOUCH if (pEvdev->mtdev && num_mt_axes_total > 0) { - int num_touches = 0; + int num_touches = num_slots(pEvdev); int mode = pEvdev->flags & EVDEV_TOUCHPAD ? XIDependentTouch : XIDirectTouch; - if (pEvdev->mtdev->caps.slot.maximum > 0) - num_touches = pEvdev->mtdev->caps.slot.maximum - - pEvdev->mtdev->caps.slot.minimum + 1; - if (!InitTouchClassDeviceStruct(device, num_touches, mode, num_mt_axes_total)) { xf86Msg(X_ERROR, "%s: failed to initialize touch class device.\n", -- 1.8.0.2 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
