Require multitouch/smooth scrolling dependencies

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
master
Peter Hutterer 11 years ago
parent 39ef4444a2
commit 2c9f4f0380
  1. 10
      configure.ac
  2. 93
      src/evdev.c
  3. 16
      src/evdev.h

@ -44,19 +44,11 @@ XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS XORG_DEFAULT_OPTIONS
# Obtain compiler/linker options from server and required extensions # Obtain compiler/linker options from server and required extensions
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto) PKG_CHECK_MODULES(XORG, [xorg-server >= 1.12] xproto [inputproto >= 2.1.99.3])
PKG_CHECK_MODULES(UDEV, libudev) PKG_CHECK_MODULES(UDEV, libudev)
PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4]) PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
if test "x$HAVE_XI22" = xyes; then
# Obtain compiler/linker options for mtdev
PKG_CHECK_MODULES(MTDEV, mtdev, HAVE_MTDEV="yes", HAVE_MTDEV="no") PKG_CHECK_MODULES(MTDEV, mtdev, HAVE_MTDEV="yes", HAVE_MTDEV="no")
fi
if test "x$HAVE_XI22" = xyes && test "x$HAVE_MTDEV" = xyes; then
AC_DEFINE(MULTITOUCH, 1, [XI2.2 available])
fi
# Define a configure option for an alternate input module directory # Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir, AC_ARG_WITH(xorg-module-dir,

@ -53,9 +53,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <evdev-properties.h> #include <evdev-properties.h>
#include <xserver-properties.h> #include <xserver-properties.h>
#ifdef MULTITOUCH
#include <mtdev-plumbing.h> #include <mtdev-plumbing.h>
#endif
#ifndef XI_PROP_PRODUCT_ID #ifndef XI_PROP_PRODUCT_ID
#define XI_PROP_PRODUCT_ID "Device Product ID" #define XI_PROP_PRODUCT_ID "Device Product ID"
@ -259,12 +257,6 @@ out:
return rc; return rc;
} }
#ifndef HAVE_SMOOTH_SCROLLING
static int wheel_up_button = 4;
static int wheel_down_button = 5;
static int wheel_left_button = 6;
static int wheel_right_button = 7;
#endif
static EventQueuePtr static EventQueuePtr
EvdevNextInQueue(InputInfoPtr pInfo) EvdevNextInQueue(InputInfoPtr pInfo)
@ -325,7 +317,6 @@ EvdevQueueProximityEvent(InputInfoPtr pInfo, int value)
} }
} }
#ifdef MULTITOUCH
void void
EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, ValuatorMask *mask, EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, ValuatorMask *mask,
uint16_t evtype) uint16_t evtype)
@ -339,7 +330,6 @@ EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, ValuatorMask *mask,
pQueue->val = evtype; pQueue->val = evtype;
} }
} }
#endif
/** /**
* Post button event right here, right now. * Post button event right here, right now.
@ -611,23 +601,6 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
value = ev->value; value = ev->value;
switch (ev->code) { switch (ev->code) {
#ifndef HAVE_SMOOTH_SCROLLING
case REL_WHEEL:
if (value > 0)
EvdevQueueButtonClicks(pInfo, wheel_up_button, value);
else if (value < 0)
EvdevQueueButtonClicks(pInfo, wheel_down_button, -value);
break;
case REL_DIAL:
case REL_HWHEEL:
if (value > 0)
EvdevQueueButtonClicks(pInfo, wheel_right_button, value);
else if (value < 0)
EvdevQueueButtonClicks(pInfo, wheel_left_button, -value);
break;
/* We don't post wheel events as axis motion. */
#endif
default: default:
/* Ignore EV_REL events if we never set up for them. */ /* Ignore EV_REL events if we never set up for them. */
if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS) && if (!(pEvdev->flags & EVDEV_RELATIVE_EVENTS) &&
@ -650,7 +623,6 @@ EvdevProcessRelativeMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
} }
} }
#ifdef MULTITOUCH
static void static void
EvdevProcessTouch(InputInfoPtr pInfo) EvdevProcessTouch(InputInfoPtr pInfo)
{ {
@ -763,10 +735,6 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
} }
} }
} }
#else
#define EvdevProcessTouch(pInfo)
#define EvdevProcessTouchEvent(pInfo, ev)
#endif /* MULTITOUCH */
/** /**
* Take the absolute motion input event and process it accordingly. * Take the absolute motion input event and process it accordingly.
@ -913,9 +881,7 @@ EvdevPostProximityEvents(InputInfoPtr pInfo, int which)
switch (pEvdev->queue[i].type) { switch (pEvdev->queue[i].type) {
case EV_QUEUE_KEY: case EV_QUEUE_KEY:
case EV_QUEUE_BTN: case EV_QUEUE_BTN:
#ifdef MULTITOUCH
case EV_QUEUE_TOUCH: case EV_QUEUE_TOUCH:
#endif
break; break;
case EV_QUEUE_PROXIMITY: case EV_QUEUE_PROXIMITY:
if (pEvdev->queue[i].val == which) if (pEvdev->queue[i].val == which)
@ -955,13 +921,11 @@ static void EvdevPostQueuedEvents(InputInfoPtr pInfo)
break; break;
case EV_QUEUE_PROXIMITY: case EV_QUEUE_PROXIMITY:
break; break;
#ifdef MULTITOUCH
case EV_QUEUE_TOUCH: case EV_QUEUE_TOUCH:
xf86PostTouchEvent(pInfo->dev, pEvdev->queue[i].detail.touch, xf86PostTouchEvent(pInfo->dev, pEvdev->queue[i].detail.touch,
pEvdev->queue[i].val, 0, pEvdev->queue[i].val, 0,
pEvdev->queue[i].touchMask); pEvdev->queue[i].touchMask);
break; break;
#endif
} }
} }
} }
@ -1033,9 +997,7 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event *ev)
static void static void
EvdevFreeMasks(EvdevPtr pEvdev) EvdevFreeMasks(EvdevPtr pEvdev)
{ {
#ifdef MULTITOUCH
int i; int i;
#endif
free(pEvdev->slots); free(pEvdev->slots);
pEvdev->slots = NULL; pEvdev->slots = NULL;
@ -1043,7 +1005,6 @@ EvdevFreeMasks(EvdevPtr pEvdev)
valuator_mask_free(&pEvdev->rel_vals); valuator_mask_free(&pEvdev->rel_vals);
valuator_mask_free(&pEvdev->old_vals); valuator_mask_free(&pEvdev->old_vals);
valuator_mask_free(&pEvdev->prox); valuator_mask_free(&pEvdev->prox);
#ifdef MULTITOUCH
valuator_mask_free(&pEvdev->mt_mask); valuator_mask_free(&pEvdev->mt_mask);
if (pEvdev->last_mt_vals) if (pEvdev->last_mt_vals)
{ {
@ -1054,10 +1015,8 @@ EvdevFreeMasks(EvdevPtr pEvdev)
} }
for (i = 0; i < EVDEV_MAXQUEUE; i++) for (i = 0; i < EVDEV_MAXQUEUE; i++)
valuator_mask_free(&pEvdev->queue[i].touchMask); valuator_mask_free(&pEvdev->queue[i].touchMask);
#endif
} }
#ifdef MULTITOUCH
static void static void
EvdevHandleMTDevEvent(InputInfoPtr pInfo, struct input_event *ev) EvdevHandleMTDevEvent(InputInfoPtr pInfo, struct input_event *ev)
{ {
@ -1072,7 +1031,6 @@ EvdevHandleMTDevEvent(InputInfoPtr pInfo, struct input_event *ev)
} }
} }
} }
#endif
static void static void
EvdevReadInput(InputInfoPtr pInfo) EvdevReadInput(InputInfoPtr pInfo)
@ -1091,21 +1049,17 @@ EvdevReadInput(InputInfoPtr pInfo)
strerror(-rc)); strerror(-rc));
break; break;
} else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) { } else if (rc == LIBEVDEV_READ_STATUS_SUCCESS) {
#ifdef MULTITOUCH
if (pEvdev->mtdev) if (pEvdev->mtdev)
EvdevHandleMTDevEvent(pInfo, &ev); EvdevHandleMTDevEvent(pInfo, &ev);
else else
#endif
EvdevProcessEvent(pInfo, &ev); EvdevProcessEvent(pInfo, &ev);
} }
else { /* SYN_DROPPED */ else { /* SYN_DROPPED */
rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_SYNC, &ev); rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
while (rc == LIBEVDEV_READ_STATUS_SYNC) { while (rc == LIBEVDEV_READ_STATUS_SYNC) {
#ifdef MULTITOUCH
if (pEvdev->mtdev) if (pEvdev->mtdev)
EvdevHandleMTDevEvent(pInfo, &ev); EvdevHandleMTDevEvent(pInfo, &ev);
else else
#endif
EvdevProcessEvent(pInfo, &ev); EvdevProcessEvent(pInfo, &ev);
rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_SYNC, &ev); rc = libevdev_next_event(pEvdev->dev, LIBEVDEV_READ_FLAG_SYNC, &ev);
} }
@ -1179,7 +1133,6 @@ EvdevAddKeyClass(DeviceIntPtr device)
return rc; return rc;
} }
#ifdef MULTITOUCH
/* MT axes are counted twice - once as ABS_X (which the kernel keeps for /* MT axes are counted twice - once as ABS_X (which the kernel keeps for
* backwards compatibility), once as ABS_MT_POSITION_X. So we need to keep a * backwards compatibility), once as ABS_MT_POSITION_X. So we need to keep a
* mapping of those axes to make sure we only count them once * mapping of those axes to make sure we only count them once
@ -1197,7 +1150,6 @@ static struct mt_axis_mappings mt_axis_mappings[] = {
{ABS_MT_PRESSURE, ABS_PRESSURE}, {ABS_MT_PRESSURE, ABS_PRESSURE},
{ABS_MT_DISTANCE, ABS_DISTANCE}, {ABS_MT_DISTANCE, ABS_DISTANCE},
}; };
#endif
/** /**
* return TRUE if the axis is not one we should count as true axis * return TRUE if the axis is not one we should count as true axis
@ -1243,7 +1195,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
if (num_axes < 1) if (num_axes < 1)
goto out; goto out;
#ifdef MULTITOUCH
/* Android drivers often have ABS_MT_POSITION_X but not ABS_X. /* Android drivers often have ABS_MT_POSITION_X but not ABS_X.
Loop over the MT->legacy axis table and add fake axes. */ Loop over the MT->legacy axis table and add fake axes. */
for (i = 0; i < ArrayLength(mt_axis_mappings); i++) for (i = 0; i < ArrayLength(mt_axis_mappings); i++)
@ -1303,12 +1254,9 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
goto out; goto out;
} }
#endif
#ifdef HAVE_SMOOTH_SCROLLING
num_axes += num_scroll_axes; num_axes += num_scroll_axes;
#endif
if (num_axes + num_mt_axes > MAX_VALUATORS) { if (num_axes + num_mt_axes > MAX_VALUATORS) {
xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS); xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS);
@ -1336,7 +1284,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
} }
} }
#ifdef MULTITOUCH
if (num_mt_axes_total > 0) { if (num_mt_axes_total > 0) {
int nslots = num_slots(pEvdev); int nslots = num_slots(pEvdev);
@ -1387,14 +1334,11 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
} }
} }
} }
#endif
atoms = malloc((pEvdev->num_vals + num_mt_axes) * sizeof(Atom)); atoms = malloc((pEvdev->num_vals + num_mt_axes) * sizeof(Atom));
i = 0; i = 0;
for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) { for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
#ifdef MULTITOUCH
int j; int j;
#endif
pEvdev->abs_axis_map[axis] = -1; pEvdev->abs_axis_map[axis] = -1;
if (!libevdev_has_event_code(pEvdev->dev, EV_ABS, axis) || if (!libevdev_has_event_code(pEvdev->dev, EV_ABS, axis) ||
is_blacklisted_axis(axis)) is_blacklisted_axis(axis))
@ -1402,7 +1346,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
mapping = i; mapping = i;
#ifdef MULTITOUCH
for (j = 0; j < ArrayLength(mt_axis_mappings); j++) for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
{ {
if (mt_axis_mappings[j].code == axis) if (mt_axis_mappings[j].code == axis)
@ -1411,13 +1354,11 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
mt_axis_mappings[j].needs_mapping) mt_axis_mappings[j].needs_mapping)
mapping = mt_axis_mappings[j].mapping; mapping = mt_axis_mappings[j].mapping;
} }
#endif
pEvdev->abs_axis_map[axis] = mapping; pEvdev->abs_axis_map[axis] = mapping;
if (mapping == i) if (mapping == i)
i++; i++;
} }
#ifdef HAVE_SMOOTH_SCROLLING
if (num_scroll_axes > 0) if (num_scroll_axes > 0)
{ {
mapping++; /* continue from abs axis mapping */ mapping++; /* continue from abs axis mapping */
@ -1429,7 +1370,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_WHEEL)) if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_WHEEL))
pEvdev->rel_axis_map[REL_WHEEL] = mapping++; pEvdev->rel_axis_map[REL_WHEEL] = mapping++;
} }
#endif
EvdevInitAxesLabels(pEvdev, Absolute, pEvdev->num_vals + num_mt_axes, atoms); EvdevInitAxesLabels(pEvdev, Absolute, pEvdev->num_vals + num_mt_axes, atoms);
@ -1439,7 +1379,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
goto out; goto out;
} }
#ifdef MULTITOUCH
if (num_mt_axes_total > 0) if (num_mt_axes_total > 0)
{ {
int num_touches = 0; int num_touches = 0;
@ -1467,7 +1406,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
} }
} }
} }
#endif
for (axis = ABS_X; axis < ABS_MT_SLOT; axis++) { for (axis = ABS_X; axis < ABS_MT_SLOT; axis++) {
const struct input_absinfo *abs; const struct input_absinfo *abs;
@ -1491,7 +1429,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
xf86InitValuatorDefaults(device, axnum); xf86InitValuatorDefaults(device, axnum);
} }
#ifdef MULTITOUCH
for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) { for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) {
const struct input_absinfo *abs; const struct input_absinfo *abs;
int axnum = pEvdev->abs_axis_map[axis]; int axnum = pEvdev->abs_axis_map[axis];
@ -1525,9 +1462,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
resolution, 0, resolution, resolution, 0, resolution,
Absolute); Absolute);
} }
#endif
#ifdef HAVE_SMOOTH_SCROLLING
if (num_scroll_axes) if (num_scroll_axes)
{ {
int idx; int idx;
@ -1573,7 +1508,6 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
SCROLL_FLAG_NONE); SCROLL_FLAG_NONE);
} }
} }
#endif
free(atoms); free(atoms);
@ -1629,7 +1563,6 @@ out:
static int static int
EvdevSetScrollValuators(DeviceIntPtr device) EvdevSetScrollValuators(DeviceIntPtr device)
{ {
#ifdef HAVE_SMOOTH_SCROLLING
InputInfoPtr pInfo; InputInfoPtr pInfo;
EvdevPtr pEvdev; EvdevPtr pEvdev;
int axnum; int axnum;
@ -1657,7 +1590,6 @@ EvdevSetScrollValuators(DeviceIntPtr device)
pEvdev->smoothScroll.horiz_delta, pEvdev->smoothScroll.horiz_delta,
SCROLL_FLAG_NONE); SCROLL_FLAG_NONE);
} }
#endif
return Success; return Success;
} }
@ -1690,9 +1622,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device, int num_scroll_axes)
(num_scroll_axes == 0 || pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)) (num_scroll_axes == 0 || pEvdev->flags & EVDEV_ABSOLUTE_EVENTS))
goto out; goto out;
#ifdef HAVE_SMOOTH_SCROLLING
num_axes += num_scroll_axes; num_axes += num_scroll_axes;
#endif
if (num_axes > MAX_VALUATORS) { if (num_axes > MAX_VALUATORS) {
xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS); xf86IDrvMsg(pInfo, X_WARNING, "found %d axes, limiting to %d.\n", num_axes, MAX_VALUATORS);
@ -1710,11 +1640,6 @@ EvdevAddRelValuatorClass(DeviceIntPtr device, int num_scroll_axes)
for (axis = REL_X, map = 0; map < MAX_VALUATORS && axis <= REL_MAX; axis++) for (axis = REL_X, map = 0; map < MAX_VALUATORS && axis <= REL_MAX; axis++)
{ {
pEvdev->rel_axis_map[axis] = -1; pEvdev->rel_axis_map[axis] = -1;
#ifndef HAVE_SMOOTH_SCROLLING
/* We don't post wheel events, so ignore them here too */
if (axis == REL_WHEEL || axis == REL_HWHEEL || axis == REL_DIAL)
continue;
#endif
if (!libevdev_has_event_code(pEvdev->dev, EV_REL, axis)) if (!libevdev_has_event_code(pEvdev->dev, EV_REL, axis))
continue; continue;
pEvdev->rel_axis_map[axis] = map; pEvdev->rel_axis_map[axis] = map;
@ -1835,14 +1760,12 @@ EvdevCountScrollAxes(EvdevPtr pEvdev)
{ {
int num_scroll_axes = 0; int num_scroll_axes = 0;
#ifdef HAVE_SMOOTH_SCROLLING
if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_WHEEL)) if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_WHEEL))
num_scroll_axes++; num_scroll_axes++;
if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_HWHEEL)) if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_HWHEEL))
num_scroll_axes++; num_scroll_axes++;
if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_DIAL)) if (libevdev_has_event_code(pEvdev->dev, EV_REL, REL_DIAL))
num_scroll_axes++; num_scroll_axes++;
#endif
return num_scroll_axes; return num_scroll_axes;
} }
@ -2243,14 +2166,12 @@ EvdevProbe(InputInfoPtr pInfo)
} }
} }
#ifdef MULTITOUCH
for (i = ABS_MT_SLOT; i < ABS_MAX; i++) { for (i = ABS_MT_SLOT; i < ABS_MAX; i++) {
if (libevdev_has_event_code(pEvdev->dev, EV_ABS, i)) { if (libevdev_has_event_code(pEvdev->dev, EV_ABS, i)) {
has_mt = TRUE; has_mt = TRUE;
break; break;
} }
} }
#endif
if (ignore_abs && has_abs_axes) if (ignore_abs && has_abs_axes)
{ {
@ -2307,10 +2228,8 @@ EvdevProbe(InputInfoPtr pInfo)
pEvdev->flags |= EVDEV_BUTTON_EVENTS; pEvdev->flags |= EVDEV_BUTTON_EVENTS;
} }
} else { } else {
#ifdef MULTITOUCH
if (!libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_MT_POSITION_X) || if (!libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_MT_POSITION_X) ||
!libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_MT_POSITION_Y)) !libevdev_has_event_code(pEvdev->dev, EV_ABS, ABS_MT_POSITION_Y))
#endif
EvdevForceXY(pInfo, Absolute); EvdevForceXY(pInfo, Absolute);
} }
} }
@ -2384,14 +2303,12 @@ EvdevProbe(InputInfoPtr pInfo)
pEvdev->flags |= EVDEV_BUTTON_EVENTS; pEvdev->flags |= EVDEV_BUTTON_EVENTS;
pEvdev->flags |= EVDEV_RELATIVE_EVENTS; pEvdev->flags |= EVDEV_RELATIVE_EVENTS;
#ifdef HAVE_SMOOTH_SCROLLING
pEvdev->smoothScroll.vert_delta = pEvdev->smoothScroll.vert_delta =
xf86SetIntOption(pInfo->options, "VertScrollDelta", 1); xf86SetIntOption(pInfo->options, "VertScrollDelta", 1);
pEvdev->smoothScroll.horiz_delta = pEvdev->smoothScroll.horiz_delta =
xf86SetIntOption(pInfo->options, "HorizScrollDelta", 1); xf86SetIntOption(pInfo->options, "HorizScrollDelta", 1);
pEvdev->smoothScroll.dial_delta = pEvdev->smoothScroll.dial_delta =
xf86SetIntOption(pInfo->options, "DialDelta", 1); xf86SetIntOption(pInfo->options, "DialDelta", 1);
#endif
} }
out: out:
@ -2421,7 +2338,6 @@ EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4])
} }
} }
#ifdef MULTITOUCH
/** /**
* Open an mtdev device for this device. mtdev is a bit too generous with * Open an mtdev device for this device. mtdev is a bit too generous with
* memory usage, so only do so for multitouch protocol A devices. * memory usage, so only do so for multitouch protocol A devices.
@ -2470,7 +2386,6 @@ EvdevOpenMTDev(InputInfoPtr pInfo)
return TRUE; return TRUE;
} }
#endif
static int static int
EvdevOpenDevice(InputInfoPtr pInfo) EvdevOpenDevice(InputInfoPtr pInfo)
@ -2528,13 +2443,11 @@ EvdevOpenDevice(InputInfoPtr pInfo)
return BadMatch; return BadMatch;
} }
#ifdef MULTITOUCH
if (!EvdevOpenMTDev(pInfo)) { if (!EvdevOpenMTDev(pInfo)) {
xf86Msg(X_ERROR, "%s: Couldn't open mtdev device\n", pInfo->name); xf86Msg(X_ERROR, "%s: Couldn't open mtdev device\n", pInfo->name);
EvdevCloseDevice(pInfo); EvdevCloseDevice(pInfo);
return BadValue; return BadValue;
} }
#endif
return Success; return Success;
} }
@ -2549,13 +2462,11 @@ EvdevCloseDevice(InputInfoPtr pInfo)
pInfo->fd = -1; pInfo->fd = -1;
} }
#ifdef MULTITOUCH
if (pEvdev->mtdev) if (pEvdev->mtdev)
{ {
mtdev_close_delete(pEvdev->mtdev); mtdev_close_delete(pEvdev->mtdev);
pEvdev->mtdev = NULL; pEvdev->mtdev = NULL;
} }
#endif
} }
@ -2600,9 +2511,7 @@ EvdevAlloc(InputInfoPtr pInfo)
pEvdev->in_proximity = 1; pEvdev->in_proximity = 1;
pEvdev->use_proximity = 1; pEvdev->use_proximity = 1;
#ifdef MULTITOUCH
pEvdev->cur_slot = -1; pEvdev->cur_slot = -1;
#endif
for (i = 0; i < ArrayLength(pEvdev->rel_axis_map); i++) for (i = 0; i < ArrayLength(pEvdev->rel_axis_map); i++)
pEvdev->rel_axis_map[i] = -1; pEvdev->rel_axis_map[i] = -1;
@ -2964,7 +2873,6 @@ EvdevInitProperty(DeviceIntPtr dev)
XISetDevicePropertyDeletable(dev, prop_btn_label, FALSE); XISetDevicePropertyDeletable(dev, prop_btn_label, FALSE);
} }
#ifdef HAVE_SMOOTH_SCROLLING
{ {
int smooth_scroll_values[3] = { int smooth_scroll_values[3] = {
pEvdev->smoothScroll.vert_delta, pEvdev->smoothScroll.vert_delta,
@ -2977,7 +2885,6 @@ EvdevInitProperty(DeviceIntPtr dev)
PropModeReplace, 3, smooth_scroll_values, FALSE); PropModeReplace, 3, smooth_scroll_values, FALSE);
XISetDevicePropertyDeletable(dev, prop_scroll_dist, FALSE); XISetDevicePropertyDeletable(dev, prop_scroll_dist, FALSE);
} }
#endif
} }

@ -43,9 +43,7 @@
#include <xf86_OSproc.h> #include <xf86_OSproc.h>
#include <xkbstr.h> #include <xkbstr.h>
#ifdef MULTITOUCH
#include <mtdev.h> #include <mtdev.h>
#endif
#include <libevdev/libevdev.h> #include <libevdev/libevdev.h>
@ -65,10 +63,6 @@
#define LED_CNT (LED_MAX+1) #define LED_CNT (LED_MAX+1)
#endif #endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
#define HAVE_SMOOTH_SCROLLING 1
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
#define LogMessageVerbSigSafe xf86MsgVerb #define LogMessageVerbSigSafe xf86MsgVerb
#endif #endif
@ -135,20 +129,14 @@ typedef struct {
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */ EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
EV_QUEUE_BTN, /* xf86PostButtonEvent() */ EV_QUEUE_BTN, /* xf86PostButtonEvent() */
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */ EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
#ifdef MULTITOUCH
EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */ EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */
#endif
} type; } type;
union { union {
int key; /* May be either a key code or button number. */ int key; /* May be either a key code or button number. */
#ifdef MULTITOUCH
unsigned int touch; /* Touch ID */ unsigned int touch; /* Touch ID */
#endif
} detail; } detail;
int val; /* State of the key/button/touch; pressed or released. */ int val; /* State of the key/button/touch; pressed or released. */
#ifdef MULTITOUCH
ValuatorMask *touchMask; ValuatorMask *touchMask;
#endif
} EventQueueRec, *EventQueuePtr; } EventQueueRec, *EventQueuePtr;
typedef struct { typedef struct {
@ -172,9 +160,7 @@ typedef struct {
int dirty; int dirty;
enum SlotState state; enum SlotState state;
} *slots; } *slots;
#ifdef MULTITOUCH
struct mtdev *mtdev; struct mtdev *mtdev;
#endif
int flags; int flags;
int in_proximity; /* device in proximity */ int in_proximity; /* device in proximity */
@ -259,10 +245,8 @@ typedef struct {
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value); void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value); void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value); void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
#ifdef MULTITOUCH
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
ValuatorMask *mask, uint16_t type); ValuatorMask *mask, uint16_t type);
#endif
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act); void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count); void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo); void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);

Loading…
Cancel
Save