summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-12-03 15:41:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2016-02-29 14:34:43 +1000
commit4564a92d59be39378170a2254ae1affb151a4757 (patch)
treea799c55cd1cb66e5f3d665bd80ab71597e969e77
parent0c2bcd0358d1107bf61ac8ff6dcb156742eb1bc6 (diff)
Support the mouse/lens tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/xf86libinput.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 0b7dfaf..505c9b6 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -851,6 +851,39 @@ xf86libinput_init_tablet_airbrush(InputInfoPtr pInfo,
}
static void
+xf86libinput_init_tablet_mouse(InputInfoPtr pInfo,
+ struct libinput_tablet_tool *tool)
+{
+ DeviceIntPtr dev = pInfo->dev;
+ int min, max, res;
+ int axis;
+
+ if (!libinput_tablet_tool_has_rotation(tool)) {
+ xf86IDrvMsg(pInfo, X_ERROR, "Mouse tool is missing the rotation axis\n");
+ return;
+ }
+
+ min = 0;
+ max = TABLET_AXIS_MAX;
+ res = 0;
+
+ /* The mouse/lens tool don't have pressure, but for backwards-compat
+ with the xorg wacom driver we initialize the the axis anyway */
+ axis = 2;
+ xf86InitValuatorAxisStruct(dev, axis,
+ XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE),
+ min, max, res * 1000, 0, res * 1000, Absolute);
+
+ axis = 3;
+ min = -TABLET_AXIS_MAX;
+ max = TABLET_AXIS_MAX;
+ xf86InitValuatorAxisStruct(dev, axis,
+ XIGetKnownProperty(AXIS_LABEL_PROP_ABS_RZ),
+ min, max, res * 1000, 0, res * 1000, Absolute);
+ return;
+}
+
+static void
xf86libinput_init_tablet(InputInfoPtr pInfo)
{
DeviceIntPtr dev = pInfo->dev;
@@ -875,6 +908,8 @@ xf86libinput_init_tablet(InputInfoPtr pInfo)
naxes += 2;
if (libinput_tablet_tool_has_slider(tool))
naxes++;
+ if (libinput_tablet_tool_has_rotation(tool))
+ naxes++;
InitPointerDeviceStruct((DevicePtr)dev,
driver_data->options.btnmap,
@@ -903,6 +938,10 @@ xf86libinput_init_tablet(InputInfoPtr pInfo)
case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
xf86libinput_init_tablet_airbrush(pInfo, tool);
break;
+ case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
+ case LIBINPUT_TABLET_TOOL_TYPE_LENS:
+ xf86libinput_init_tablet_mouse(pInfo, tool);
+ break;
default:
xf86IDrvMsg(pInfo, X_ERROR, "Tool type not supported yet\n");
break;
@@ -1318,6 +1357,12 @@ xf86libinput_handle_tablet_axis(InputInfoPtr pInfo,
valuator_mask_set_double(mask, 5, value);
}
+ if (libinput_tablet_tool_has_rotation(tool)) {
+ value = libinput_event_tablet_tool_get_rotation(event);
+ value *= TABLET_AXIS_MAX;
+ valuator_mask_set_double(mask, 3, value);
+ }
+
xf86PostMotionEventM(dev, Absolute, mask);
}