summaryrefslogtreecommitdiff
path: root/src/evdev.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-10-14 11:48:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-10-14 11:49:29 +1000
commitcabed4bbb6757e55f067126965f26bb0f716fb55 (patch)
tree5598c0c75617a00013ec16c88e22c71cfe22cdd3 /src/evdev.c
parenta75c43830ef2f1b9ba0e265baf614cdfea617beb (diff)
Use num_slots where appropriate
This was supposed to be added in 43e270fb7a10da20ab89dd699839c1cb6df119b4, but got lost somehow. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/evdev.c')
-rw-r--r--src/evdev.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/evdev.c b/src/evdev.c
index d14d08f..1aa92d2 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1342,13 +1342,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
}
#ifdef MULTITOUCH
if (num_mt_axes_total > 0) {
- int num_slots = 0;
-
- if (pEvdev->mtdev) {
- num_slots = pEvdev->mtdev->caps.slot.maximum -
- pEvdev->mtdev->caps.slot.minimum + 1;
- } else
- num_slots = libevdev_get_num_slots(pEvdev->dev);
+ int nslots = num_slots(pEvdev);
pEvdev->num_mt_vals = num_mt_axes_total;
pEvdev->mt_mask = valuator_mask_new(num_mt_axes_total);
@@ -1358,7 +1352,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
goto out;
}
- pEvdev->last_mt_vals = calloc(num_slots, sizeof(ValuatorMask *));
+ pEvdev->last_mt_vals = calloc(nslots, sizeof(ValuatorMask *));
if (!pEvdev->last_mt_vals) {
xf86IDrvMsg(pInfo, X_ERROR,
"%s: failed to allocate MT last values mask array.\n",
@@ -1366,7 +1360,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
goto out;
}
- for (i = 0; i < num_slots; i++) {
+ for (i = 0; i < nslots; i++) {
pEvdev->last_mt_vals[i] = valuator_mask_new(num_mt_axes_total);
if (!pEvdev->last_mt_vals[i]) {
xf86IDrvMsg(pInfo, X_ERROR,
@@ -1445,12 +1439,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int want_scroll_axes)
int mode = pEvdev->flags & EVDEV_TOUCHPAD ?
XIDependentTouch : XIDirectTouch;
- if (pEvdev->mtdev) {
- if (pEvdev->mtdev->caps.slot.maximum > 0)
- num_touches = pEvdev->mtdev->caps.slot.maximum -
- pEvdev->mtdev->caps.slot.minimum + 1;
- } else
- num_touches = num_slots(pEvdev);
+ num_touches = num_slots(pEvdev);
if (!InitTouchClassDeviceStruct(device, num_touches, mode,
num_mt_axes_total)) {