xserver-xorg-input-evdev: Changes to 'upstream-experimental'
configure.ac | 15
include/evdev-properties.h | 21
man/evdev.man | 28
src/Makefile.am | 5
src/apple.c | 312 +++++++++
src/draglock.c | 33 -
src/emuMB.c | 7
src/emuThird.c | 416 ++++++++++++
src/emuWheel.c | 54 -
src/evdev.c | 1476 ++++++++++++++++++++++++---------------------
src/evdev.h | 117 ++-
src/udev.c | 69 ++
12 files changed, 1781 insertions(+), 772 deletions(-)
New commits:
commit 4b76d80e934f5503c712289ce73d4e10cc79bba6
Author: Cyril Brulebois <kibi@debian.org>
Date: Sat Dec 31 18:38:30 2011 +0100
evdev 2.6.99.901
Signed-off-by: Cyril Brulebois <kibi@debian.org>
diff --git a/configure.ac b/configure.ac
index 10ec8ac..57690c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-evdev],
- [2.6.99],
+ [2.6.99.901],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-evdev])
AC_CONFIG_SRCDIR([Makefile.am])
commit 6dd6f2d3c6b2fee5f78b01618643c7f3ed0819c3
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Dec 29 10:37:38 2011 +1000
Require xserver 1.12 RC1
Remove the ABI check hack, just check for the server version directly now
that we have one that definitely has the multitouch APIs.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 451a730..10ec8ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,7 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
PKG_CHECK_MODULES(UDEV, udev)
-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3], HAVE_XI22="yes", HAVE_XI22="no")
+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
if test "x$HAVE_XI22" = xyes; then
# Obtain compiler/linker options for mtdev
diff --git a/src/evdev.h b/src/evdev.h
index 609365f..acd4289 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -43,17 +43,6 @@
#include <xf86_OSproc.h>
#include <xkbstr.h>
-/* FIXME: once the server version is bumped, we can remove this with a
- * proper pkg-config check. Right now we need an inputproto check for
- * the right protocol, the pkgconfig check for the mtdev pkgconfig, and an
- * ABI check to undo the first two if the proto was updated but the server
- * wasn't yet */
-#ifdef MULTITOUCH
-#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 16
-#undef MULTITOUCH
-#endif
-#endif
-
#ifdef MULTITOUCH
#include <mtdev.h>
#endif
commit 0c7c087f77132657dd8ee342963bb1b51d659571
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Dec 29 10:19:48 2011 +1000
Test for mtdev before assuming multitouch
If the XI2.2 headers are present but mtdev isn't, build without MULTITOUCH
defined.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 5671193..451a730 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,13 +48,14 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
PKG_CHECK_MODULES(UDEV, udev)
-PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3],
- HAVE_XI22="yes"; AC_DEFINE(MULTITOUCH, 1, [XI2.2 available]),
- HAVE_XI22="no")
+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3], HAVE_XI22="yes", HAVE_XI22="no")
if test "x$HAVE_XI22" = xyes; then
# Obtain compiler/linker options for mtdev
- PKG_CHECK_MODULES(MTDEV, mtdev)
+ 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
commit ba9377c6d9e6d0d2813e471b516bb36902dae2ce
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Sat Dec 24 12:19:40 2011 +1000
Remove need for --enable-multitouch
If we spot inputproto 2.1.99.3, we assume we have a capable X server. This
should really be a server version check, but the server version hasn't been
bumped yet.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index cfff2d4..5671193 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,16 +48,11 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
PKG_CHECK_MODULES(UDEV, udev)
-# Whether to include support for experimental XI 2.2 multitouch
-AC_ARG_ENABLE(multitouch,
- AC_HELP_STRING([--enable-multitouch],
- [Enable experimental XI 2.2 multitouch support [[default: disabled]]]),
- [MULTITOUCH=$enableval],
- [MULTITOUCH=no])
-
-if test "x$MULTITOUCH" = xyes; then
- AC_DEFINE(MULTITOUCH, 1, [Enable experimental multitouch code])
+PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3],
+ HAVE_XI22="yes"; AC_DEFINE(MULTITOUCH, 1, [XI2.2 available]),
+ HAVE_XI22="no")
+if test "x$HAVE_XI22" = xyes; then
# Obtain compiler/linker options for mtdev
PKG_CHECK_MODULES(MTDEV, mtdev)
fi
diff --git a/src/evdev.h b/src/evdev.h
index acd4289..609365f 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -43,6 +43,17 @@
#include <xf86_OSproc.h>
#include <xkbstr.h>
+/* FIXME: once the server version is bumped, we can remove this with a
+ * proper pkg-config check. Right now we need an inputproto check for
+ * the right protocol, the pkgconfig check for the mtdev pkgconfig, and an
+ * ABI check to undo the first two if the proto was updated but the server
+ * wasn't yet */
+#ifdef MULTITOUCH
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 16
+#undef MULTITOUCH
+#endif
+#endif
+
#ifdef MULTITOUCH
#include <mtdev.h>
#endif
commit 7f7606fc461dca1f087a756c85e22f2cc773d008
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Sat Dec 24 12:31:34 2011 +1000
Include config.h from evdev.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.h b/src/evdev.h
index 7d49919..acd4289 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -28,6 +28,10 @@
* Oliver McFadden (oliver.mcfadden@nokia.com)
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#ifndef EVDEV_H
#define EVDEV_H
commit 0ba58f483e564bd815bae36f6272029693c1fd5c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Sat Dec 24 12:18:16 2011 +1000
Always include mt_mask in the evdev struct
Even if MT support isn't available, include it in the build. The checks in
the code check whether mt_mask is non-NULL but they would all need ifdef
escaping otherwise.
Leave the mtdev part inside the ifdef however, so that we don't need the
mtdev header if we don't build with multitouch.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.h b/src/evdev.h
index 5fd99ff..7d49919 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -153,10 +153,10 @@ typedef struct {
ValuatorMask *vals; /* new values coming in */
ValuatorMask *old_vals; /* old values for calculating relative motion */
ValuatorMask *prox; /* last values set while not in proximity */
-#ifdef MULTITOUCH
ValuatorMask *mt_mask;
int cur_slot;
enum SlotState slot_state;
+#ifdef MULTITOUCH
struct mtdev *mtdev;
#endif
commit e99ab2314f712df8dd705b16008755f8b3095707
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Dec 20 15:08:06 2011 +1000
Don't count legacy and MT axes twice
The kernel exports both ABS_X and ABS_MT_POSITION_X (and a couple others)
for a multi-touch capable device. For such devices, only count the axis once
since we submit ABS_MT_POSITION_X through ABS_X.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index 00c9935..aef1d6e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -748,12 +748,7 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
else
pEvdev->slot_state = SLOTSTATE_CLOSE;
} else {
- if (ev->code == ABS_MT_POSITION_X)
- map = pEvdev->axis_map[ABS_X];
- else if (ev->code == ABS_MT_POSITION_Y)
- map = pEvdev->axis_map[ABS_Y];
- else
- map = pEvdev->axis_map[ev->code] - pEvdev->num_vals;
+ map = pEvdev->axis_map[ev->code];
valuator_mask_set(pEvdev->mt_mask, map, ev->value);
}
}
@@ -1131,6 +1126,24 @@ EvdevAddKeyClass(DeviceIntPtr device)
return Success;
}
+/* 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
+ * mapping of those axes to make sure we only count them once
+ */
+struct mt_axis_mappings {
+ int mt_code;
+ int code;
+ Bool needs_mapping; /* TRUE if both code and mt_code are present */
+ int mapping; /* Logical mapping of 'code' axis */
+};
+
+static struct mt_axis_mappings mt_axis_mappings[] = {
+ {ABS_MT_POSITION_X, ABS_X},
+ {ABS_MT_POSITION_Y, ABS_Y},
+ {ABS_MT_PRESSURE, ABS_PRESSURE},
+ {ABS_MT_DISTANCE, ABS_DISTANCE},
+};
+
/**
* return TRUE if the axis is not one we should count as true axis
*/
@@ -1154,7 +1167,9 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
InputInfoPtr pInfo;
EvdevPtr pEvdev;
int num_axes, axis, i = 0;
- int num_mt_axes = 0;
+ int num_mt_axes = 0, /* number of MT-only axes */
+ num_mt_axes_total = 0; /* total number of MT axes, including
+ double-counted ones, excluding blacklisted */
Atom *atoms;
pInfo = device->public.devicePrivate;
@@ -1172,26 +1187,35 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
{
if (EvdevBitIsSet(pEvdev->abs_bitmask, axis))
{
+ int j;
+ Bool skip = FALSE;
+
+ for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
+ {
+ if (mt_axis_mappings[j].mt_code == axis &&
+ BitIsOn(pEvdev->abs_bitmask, mt_axis_mappings[j].code))
+ {
+ mt_axis_mappings[j].needs_mapping = TRUE;
+ skip = TRUE;
+ }
+ }
+
if (!is_blacklisted_axis(axis))
- num_mt_axes++;
+ {
+ num_mt_axes_total++;
+ if (!skip)
+ num_mt_axes++;
+ }
num_axes--;
}
}
#endif
-
- if (num_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);
num_axes = MAX_VALUATORS;
}
-#ifdef MULTITOUCH
- if (num_mt_axes > MAX_VALUATORS) {
- xf86Msg(X_WARNING, "%s: found %d MT axes, limiting to %d.\n", device->name, num_axes, MAX_VALUATORS);
- num_mt_axes = MAX_VALUATORS;
- }
-#endif
-
- if (num_axes < 1 && num_mt_axes < 1) {
+ if (num_axes < 1 && num_mt_axes_total < 1) {
xf86Msg(X_WARNING, "%s: no absolute or touch axes found.\n",
device->name);
return !Success;
@@ -1207,8 +1231,8 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
}
}
#ifdef MULTITOUCH
- if (num_mt_axes > 0) {
- pEvdev->mt_mask = valuator_mask_new(num_mt_axes);
+ if (num_mt_axes_total > 0) {
+ pEvdev->mt_mask = valuator_mask_new(num_mt_axes_total);
if (!pEvdev->mt_mask) {
xf86Msg(X_ERROR, "%s: failed to allocate MT valuator mask.\n",
device->name);
@@ -1217,7 +1241,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
for (i = 0; i < EVDEV_MAXQUEUE; i++) {
pEvdev->queue[i].touchMask =
- valuator_mask_new(num_mt_axes);
+ valuator_mask_new(num_mt_axes_total);
if (!pEvdev->queue[i].touchMask) {
xf86Msg(X_ERROR, "%s: failed to allocate MT valuator masks for "
"evdev event queue.\n", device->name);
@@ -1230,12 +1254,27 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
i = 0;
for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
+ int j;
+ int mapping;
pEvdev->axis_map[axis] = -1;
if (!EvdevBitIsSet(pEvdev->abs_bitmask, axis) ||
is_blacklisted_axis(axis))
continue;
- pEvdev->axis_map[axis] = i;
- i++;
+
+ mapping = i;
+
+ for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
+ {
+ if (mt_axis_mappings[j].code == axis)
+ mt_axis_mappings[j].mapping = mapping;
+ else if (mt_axis_mappings[j].mt_code == axis &&
+ mt_axis_mappings[j].needs_mapping)
+ mapping = mt_axis_mappings[j].mapping;
+ }
+
+ pEvdev->axis_map[axis] = mapping;
+ if (mapping == i)
+ i++;
}
EvdevInitAxesLabels(pEvdev, pEvdev->num_vals + num_mt_axes, atoms);
@@ -1247,7 +1286,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
}
#ifdef MULTITOUCH
- if (num_mt_axes > 0)
+ if (num_mt_axes_total > 0)
{
int num_touches = 0;
int mode = pEvdev->flags & EVDEV_TOUCHPAD ?
@@ -1257,7 +1296,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
num_touches = pEvdev->mtdev->caps.slot.maximum;
if (!InitTouchClassDeviceStruct(device, num_touches, mode,
- num_mt_axes)) {
+ num_mt_axes_total)) {
xf86Msg(X_ERROR, "%s: failed to initialize touch class device.\n",
device->name);
goto out;
@@ -1288,17 +1327,31 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
#ifdef MULTITOUCH
for (axis = ABS_MT_TOUCH_MAJOR; axis <= ABS_MAX; axis++) {
- int axnum = pEvdev->axis_map[axis] - pEvdev->num_vals;
+ int axnum = pEvdev->axis_map[axis];
int resolution = 10000;
+ int j;
+ BOOL skip = FALSE;
if (axnum < 0)
continue;
+ for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
+ if (mt_axis_mappings[j].mt_code == axis &&
+ mt_axis_mappings[j].needs_mapping)
+ {
+ skip = TRUE;
+ break;
+ }
+
+ /* MT axis is mapped, don't set up twice */
+ if (skip)
+ continue;
+
if (pEvdev->absinfo[axis].resolution)
resolution = pEvdev->absinfo[axis].resolution * 1000;
xf86InitValuatorAxisStruct(device, axnum,
- atoms[axnum + pEvdev->num_vals],
+ atoms[axnum],
pEvdev->absinfo[axis].minimum,
pEvdev->absinfo[axis].maximum,
resolution, 0, resolution,
commit 191660189a01b9c96bb4c0fa1a2e5008ae666238
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Dec 20 14:14:16 2011 +1000
Add is_blacklisted_axis() helper
The kernel exports a bunch of information as axis that shouldn't be an axis
and we don't treat it as axis in the server. Add this helper instead of
checking for the axis codes manually.
No function change.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index 9a5608b..00c9935 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1131,6 +1131,23 @@ EvdevAddKeyClass(DeviceIntPtr device)
return Success;
}
+/**
+ * return TRUE if the axis is not one we should count as true axis
+ */
+static int
+is_blacklisted_axis(int axis)
+{
+ switch(axis)
+ {
+ case ABS_MT_SLOT:
+ case ABS_MT_TRACKING_ID:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+}
+
+
static int
EvdevAddAbsValuatorClass(DeviceIntPtr device)
{
@@ -1155,7 +1172,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
{
if (EvdevBitIsSet(pEvdev->abs_bitmask, axis))
{
- if(axis != ABS_MT_SLOT && axis != ABS_MT_TRACKING_ID)
+ if (!is_blacklisted_axis(axis))
num_mt_axes++;
num_axes--;
}
@@ -1215,7 +1232,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
pEvdev->axis_map[axis] = -1;
if (!EvdevBitIsSet(pEvdev->abs_bitmask, axis) ||
- axis == ABS_MT_SLOT || axis == ABS_MT_TRACKING_ID)
+ is_blacklisted_axis(axis))
continue;
pEvdev->axis_map[axis] = i;
i++;
commit a1c3f8efbbff7f93e216ccdb32bd176a8ba33b09
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Dec 20 13:32:06 2011 +1000
Drop now-unnecessary XI 2.1 and XI 2.2 error suppression defines
Gone since inputproto 2.1.99.3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 381883b..cfff2d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,8 +57,6 @@ AC_ARG_ENABLE(multitouch,
if test "x$MULTITOUCH" = xyes; then
AC_DEFINE(MULTITOUCH, 1, [Enable experimental multitouch code])
- AC_DEFINE(XINPUT2_1_USE_UNSTABLE_PROTOCOL, 1, [Enable XI 2.1 protocol])
- AC_DEFINE(XINPUT2_2_USE_UNSTABLE_PROTOCOL, 1, [Enable XI 2.2 protocol])
# Obtain compiler/linker options for mtdev
PKG_CHECK_MODULES(MTDEV, mtdev)
commit f3c628acc4f7399325756590cdc72e769341243c
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Dec 20 10:56:22 2011 +1000
Map ABS_MT_POSITION_X/Y into ABS_X/Y
MT axes are the same as traditional axes, so one into the other so we get
x/y coordinates regardless wich axes it comes from.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index 8adfefd..9a5608b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -748,7 +748,12 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
else
pEvdev->slot_state = SLOTSTATE_CLOSE;
} else {
- map = pEvdev->axis_map[ev->code] - pEvdev->num_vals;
+ if (ev->code == ABS_MT_POSITION_X)
+ map = pEvdev->axis_map[ABS_X];
+ else if (ev->code == ABS_MT_POSITION_Y)
+ map = pEvdev->axis_map[ABS_Y];
+ else
+ map = pEvdev->axis_map[ev->code] - pEvdev->num_vals;
valuator_mask_set(pEvdev->mt_mask, map, ev->value);
}
}
commit 7909975b0b965fbf0935bf012987a5368ea0e67a
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date: Thu Dec 15 12:26:37 2011 -0200
Fix relative events with swapped axes
After we swap the axes, we only call valuator_mask_set for axes that are
not zero, so we need to unset the axes that became zero when swapped.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index b1f9b2e..562c7e7 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -408,6 +408,10 @@ EvdevProcessValuators(InputInfoPtr pInfo)
tmp = pEvdev->delta[REL_X];
pEvdev->delta[REL_X] = pEvdev->delta[REL_Y];
pEvdev->delta[REL_Y] = tmp;
+ if (pEvdev->delta[REL_X] == 0)
+ valuator_mask_unset(pEvdev->vals, REL_X);
+ if (pEvdev->delta[REL_Y] == 0)
+ valuator_mask_unset(pEvdev->vals, REL_Y);
}
if (pEvdev->invert_x)
pEvdev->delta[REL_X] *= -1;
commit 8d6dfd13b0c4177305555294218e366a6cddc83f
Author: Paulo Zanoni <paulo.r.zanoni@intel.com>
Date: Wed Dec 14 15:23:36 2011 -0200
Fix absolute events with swapped axes
We were correctly swapping the valuator values, but we were not
calling valuator_mask_unset() when needed, so the cursor kept jumping
to the edges.
This patch does the swapping before the main "for", so we don't need to
store unswapped_{x,y} and unswapped_isset_{x,y} even when we don't need
to swap.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index 428d3c1..b1f9b2e 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -436,10 +436,30 @@ EvdevProcessValuators(InputInfoPtr pInfo)
* just works.
*/
else if (pEvdev->abs_queued && pEvdev->in_proximity) {
- int unswapped_x = valuator_mask_get(pEvdev->vals, 0);
- int unswapped_y = valuator_mask_get(pEvdev->vals, 1);
int i;
+ if (pEvdev->swap_axes) {
+ int swapped_isset[2] = {0, 0};
+ int swapped_values[2];
+
+ for(i = 0; i <= 1; i++)
+ if (valuator_mask_isset(pEvdev->vals, i)) {
+ swapped_isset[1 - i] = 1;
+ swapped_values[1 - i] =
+ xf86ScaleAxis(valuator_mask_get(pEvdev->vals, i),
+ pEvdev->absinfo[1 - i].maximum,
+ pEvdev->absinfo[1 - i].minimum,
+ pEvdev->absinfo[i].maximum,
+ pEvdev->absinfo[i].minimum);
+ }
+
+ for (i = 0; i <= 1; i++)
+ if (swapped_isset[i])
+ valuator_mask_set(pEvdev->vals, i, swapped_values[i]);
+ else
+ valuator_mask_unset(pEvdev->vals, i);
+ }
+
for (i = 0; i <= 1; i++) {
int val;
int calib_min;
@@ -458,13 +478,6 @@ EvdevProcessValuators(InputInfoPtr pInfo)
calib_max = pEvdev->calibration.max_y;
}
- if (pEvdev->swap_axes)
- val = xf86ScaleAxis((i == 0 ? unswapped_y : unswapped_x),
- pEvdev->absinfo[i].maximum,
- pEvdev->absinfo[i].minimum,
- pEvdev->absinfo[1 - i].maximum,
- pEvdev->absinfo[1 - i].minimum);
-
if (pEvdev->flags & EVDEV_CALIBRATED)
val = xf86ScaleAxis(val, pEvdev->absinfo[i].maximum,
pEvdev->absinfo[i].minimum, calib_max,
commit fed454192ddc4ad94226040c657deb6abea3df88
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Dec 15 08:55:32 2011 +1000
Use xf86InitValuatorAxisStruct, the touch-specific version was dropped
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index 760f3ce..8adfefd 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1275,11 +1275,12 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
if (pEvdev->absinfo[axis].resolution)
resolution = pEvdev->absinfo[axis].resolution * 1000;
- xf86InitTouchValuatorAxisStruct(device, axnum,
- atoms[axnum + pEvdev->num_vals],
- pEvdev->absinfo[axis].minimum,
- pEvdev->absinfo[axis].maximum,
- pEvdev->absinfo[axis].resolution);
+ xf86InitValuatorAxisStruct(device, axnum,
+ atoms[axnum + pEvdev->num_vals],
+ pEvdev->absinfo[axis].minimum,
+ pEvdev->absinfo[axis].maximum,
+ resolution, 0, resolution,
+ Absolute);
}
#endif
commit cf93a21df1dd66118d3a1f5a0769d48f317de749
Author: Chase Douglas <chase.douglas@canonical.com>
Date: Tue Nov 29 18:02:58 2011 -0800
Don't send pointer events for multitouch touchscreen devices
Pointer events will be emulated by the server.
Signed-off-by: Chase Douglas <chase.douglas@canonical.com>
diff --git a/src/evdev.c b/src/evdev.c
index f88074b..760f3ce 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -781,14 +781,14 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
if (EvdevWheelEmuFilterMotion(pInfo, ev))
return;
- if (ev->code >= ABS_MT_SLOT)
+ if (ev->code >= ABS_MT_SLOT) {
EvdevProcessTouchEvent(pInfo, ev);
- else {
+ pEvdev->abs_queued = 1;
+ } else if (!pEvdev->mt_mask) {
map = pEvdev->axis_map[ev->code];
valuator_mask_set(pEvdev->vals, map, value);
+ pEvdev->abs_queued = 1;
}
-
- pEvdev->abs_queued = 1;
}
/**
@@ -823,7 +823,8 @@ EvdevProcessKeyEvent(InputInfoPtr pInfo, struct input_event *ev)
* BTN_TOUCH as the proximity notifier */
if (!pEvdev->use_proximity)
pEvdev->in_proximity = value ? ev->code : 0;
- if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)))
+ if (!(pEvdev->flags & (EVDEV_TOUCHSCREEN | EVDEV_TABLET)) ||
+ pEvdev->mt_mask)
break;
/* Treat BTN_TOUCH from devices that only have BTN_TOUCH as
* BTN_LEFT. */
commit fac1a41c75a7c4bfabff34dc8ed1dff2587c6011
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Nov 11 15:57:26 2011 +1000
Add the required defines to compile against the inputproto
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index cfff2d4..381883b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -57,6 +57,8 @@ AC_ARG_ENABLE(multitouch,
if test "x$MULTITOUCH" = xyes; then
AC_DEFINE(MULTITOUCH, 1, [Enable experimental multitouch code])
+ AC_DEFINE(XINPUT2_1_USE_UNSTABLE_PROTOCOL, 1, [Enable XI 2.1 protocol])
+ AC_DEFINE(XINPUT2_2_USE_UNSTABLE_PROTOCOL, 1, [Enable XI 2.2 protocol])
# Obtain compiler/linker options for mtdev
PKG_CHECK_MODULES(MTDEV, mtdev)
commit 3175a2a96d448a0b2584a58ab3d05fbebb11fab1
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed Nov 2 09:53:34 2011 +1000
Print to the log if we find multitouch axes.
No real effect on the code, but it helps to have that line in the log when
searching for driver issues.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index 4bb55f5..f88074b 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1866,6 +1866,7 @@ EvdevProbe(InputInfoPtr pInfo)
{
int i, has_rel_axes, has_abs_axes, has_keys, num_buttons, has_scroll;
int has_lmr; /* left middle right */
+ int has_mt; /* multitouch */
int ignore_abs = 0, ignore_rel = 0;
EvdevPtr pEvdev = pInfo->private;
int rc = 1;
@@ -1899,6 +1900,7 @@ EvdevProbe(InputInfoPtr pInfo)
has_keys = FALSE;
has_scroll = FALSE;
has_lmr = FALSE;
+ has_mt = FALSE;
num_buttons = 0;
/* count all buttons */
@@ -1966,6 +1968,15 @@ EvdevProbe(InputInfoPtr pInfo)
}
}
+#ifdef MULTITOUCH
+ for (i = ABS_MT_SLOT; i < ABS_MAX; i++) {
+ if (EvdevBitIsSet(pEvdev->abs_bitmask, i)) {
+ has_mt = TRUE;
+ break;
+ }
+ }
+#endif
+
if (ignore_abs && has_abs_axes)
{
xf86IDrvMsg(pInfo, X_INFO, "Absolute axes present but ignored.\n");
@@ -1974,6 +1985,9 @@ EvdevProbe(InputInfoPtr pInfo)
xf86IDrvMsg(pInfo, X_PROBED, "Found absolute axes\n");
pEvdev->flags |= EVDEV_ABSOLUTE_EVENTS;
+ if (has_mt)
+ xf86IDrvMsg(pInfo, X_PROBED, "Found absolute multitouch axes\n");
+
if ((EvdevBitIsSet(pEvdev->abs_bitmask, ABS_X) &&
EvdevBitIsSet(pEvdev->abs_bitmask, ABS_Y))) {
xf86IDrvMsg(pInfo, X_PROBED, "Found x and y absolute axes\n");
commit 5e9b027807cc205dc9c4efbb8360ac4b20317682
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Mon Oct 31 08:58:18 2011 +1000
Replace 0/1 button values with enums
BUTTON_PRESS is much harder to confuse with a button number than a simple 1.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/emuMB.c b/src/emuMB.c
index b7a57b8..eb01495 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -191,7 +191,8 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
pEvdev->emulateMB.pending = FALSE;
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
- EvdevPostButtonEvent(pInfo, abs(id), (id >= 0));
+ EvdevPostButtonEvent(pInfo, abs(id),
+ (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
pEvdev->emulateMB.state =
stateTab[pEvdev->emulateMB.state][4][2];
} else {
diff --git a/src/emuThird.c b/src/emuThird.c
index d89fd9e..7461767 100644
--- a/src/emuThird.c
+++ b/src/emuThird.c
@@ -58,7 +58,7 @@ enum EmulationState {
};
static void
-Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, int press)
+Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
@@ -72,7 +72,8 @@ Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, int press)
if (emu3B->flags & EVDEV_ABSOLUTE_EVENTS)
absolute = Absolute;
- xf86PostButtonEventP(pInfo->dev, absolute, button, press, 0,
+ xf86PostButtonEventP(pInfo->dev, absolute, button,
+ (act == BUTTON_PRESS) ? 1 : 0, 0,
(absolute ? 2 : 0), emu3B->startpos);
}
@@ -92,7 +93,7 @@ Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg)
sigstate = xf86BlockSIGIO ();
emu3B->state = EM3B_EMULATING;
- Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
xf86UnblockSIGIO (sigstate);
return 0;
}
@@ -145,14 +146,14 @@ Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
switch (emu3B->state)
{
case EM3B_PENDING:
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
break;
case EM3B_EMULATING:
/* We're emulating and now the user pressed a different
* button. Just release the emulating one, tell the user to
* not do that and get on with life */
- Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, 0);
+ Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
Evdev3BCancel(pInfo);
break;
default:
@@ -171,11 +172,11 @@ Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
switch(emu3B->state)
{
case EM3B_PENDING:
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
break;
case EM3B_EMULATING:
- Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, 0);
+ Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
Evdev3BCancel(pInfo);
ret = TRUE;
break;
@@ -237,7 +238,7 @@ Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
if (cancel)
{
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
}
}
@@ -262,7 +263,7 @@ Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy)
if (abs(emu3B->delta[0]) > emu3B->threshold ||
abs(emu3B->delta[1]) > emu3B->threshold)
{
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
}
}
diff --git a/src/evdev.c b/src/evdev.c
index 13b1e10..4bb55f5 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -411,9 +411,10 @@ EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, ValuatorMask *mask,
* Interface for MB emulation since these need to post immediately.
*/
void
-EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value)
+EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
{
- xf86PostButtonEvent(pInfo->dev, Relative, button, value, 0, 0);
+ xf86PostButtonEvent(pInfo->dev, Relative, button,
+ (act == BUTTON_PRESS) ? 1 : 0, 0, 0);
}
void
diff --git a/src/evdev.h b/src/evdev.h
index 27e404c..5fd99ff 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -107,6 +107,11 @@ enum SlotState {
SLOTSTATE_EMPTY,
};
+enum ButtonAction {
+ BUTTON_RELEASE = 0,
+ BUTTON_PRESS = 1
+};
+
/* axis specific data for wheel emulation */
typedef struct {
int up_button;
@@ -248,7 +253,7 @@ void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
ValuatorMask *mask, uint16_t type);
#endif
-void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value);
+void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS]);
commit 2ce305129ca94394096f4d697d51eb120de2940b
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed Oct 26 13:21:18 2011 +1000
Skip event posting for empty slots.
ABS_MT_SLOT comes before any other events. The following order of events
is common for protocol B devices (and mtdev):
...
EV_SYN
ABS_MT_SLOT → posting here means we miss on the position information
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
ABS_MT_SLOT
ABS_MT_POSITION_X
ABS_MT_POSITION_Y
EV_SYN
Store the stot state as SLOT_EMPTY after posting an event (i.e. EV_SYN and
ABS_MT_SLOT) and then don't post until the next slot/syn event.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/evdev.c b/src/evdev.c
index b55a0aa..13b1e10 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -709,6 +709,10 @@ EvdevProcessTouch(InputInfoPtr pInfo)
if (pEvdev->cur_slot < 0 || !pEvdev->mt_mask)
return;
+ /* If the ABS_MT_SLOT is the first event we get after EV_SYN, skip this */
+ if (pEvdev->slot_state == SLOTSTATE_EMPTY)
Reply to: