aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2012-01-13 09:51:36 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2012-01-18 16:47:16 +1000
commit9d9c9870c88f2c636799a68cde8efcab59a4a2a5 (patch)
tree0688149f7fa1e68bda634d394a5915c323695956 /src
parentForce x/y axes to exist on devices with any other axes (#44655) (diff)
downloadxf86-input-evdev-9d9c9870c88f2c636799a68cde8efcab59a4a2a5.tar.gz
xf86-input-evdev-9d9c9870c88f2c636799a68cde8efcab59a4a2a5.tar.bz2
xf86-input-evdev-9d9c9870c88f2c636799a68cde8efcab59a4a2a5.zip
Prefere relative axis labelling over absolute axis labelling
If a device has both relative and absolute axes, we'd initialise the relative axes but label them with the absolute labels. The current code is broken for mixed mode devices. Most of these devices operate primarily in relative mode, but have some absolute axes available for secondary functionality. For now, label the relative axes properly. We can fix the absolute axes later. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/evdev.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/evdev.c b/src/evdev.c
index effac40..1cdba41 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -120,7 +120,7 @@ static BOOL EvdevGrabDevice(InputInfoPtr pInfo, int grab, int ungrab);
static void EvdevSetCalibration(InputInfoPtr pInfo, int num_calibration, int calibration[4]);
static int EvdevOpenDevice(InputInfoPtr pInfo);
-static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
+static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms);
static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms);
static void EvdevInitProperty(DeviceIntPtr dev);
static int EvdevSetProperty(DeviceIntPtr dev, Atom atom,
@@ -1297,7 +1297,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device)
i++;
}
- EvdevInitAxesLabels(pEvdev, pEvdev->num_vals + num_mt_axes, atoms);
+ EvdevInitAxesLabels(pEvdev, Absolute, pEvdev->num_vals + num_mt_axes, atoms);
if (!InitValuatorClassDeviceStruct(device, num_axes + num_mt_axes, atoms,
GetMotionHistorySize(), Absolute)) {
@@ -1496,7 +1496,7 @@ EvdevAddRelValuatorClass(DeviceIntPtr device)
i++;
}
- EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
+ EvdevInitAxesLabels(pEvdev, Relative, pEvdev->num_vals, atoms);
if (!InitValuatorClassDeviceStruct(device, num_axes, atoms,
GetMotionHistorySize(), Relative)) {
@@ -2637,18 +2637,18 @@ static char* btn_labels[][16] = {
}
};
-static void EvdevInitAxesLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
+static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms)
{
Atom atom;
int axis;
char **labels;
int labels_len = 0;
- if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
+ if (mode == Absolute)
{
labels = abs_labels;
labels_len = ArrayLength(abs_labels);
- } else if ((pEvdev->flags & EVDEV_RELATIVE_EVENTS))
+ } else if (mode == Relative)
{
labels = rel_labels;
labels_len = ArrayLength(rel_labels);
@@ -2810,8 +2810,19 @@ EvdevInitProperty(DeviceIntPtr dev)
/* Axis labelling */
if ((pEvdev->num_vals > 0) && (prop_axis_label = XIGetKnownProperty(AXIS_LABEL_PROP)))
{
+ int mode;
Atom atoms[pEvdev->num_vals];
- EvdevInitAxesLabels(pEvdev, pEvdev->num_vals, atoms);
+
+ if (pEvdev->flags & EVDEV_ABSOLUTE_EVENTS)
+ mode = Absolute;
+ else if (pEvdev->flags & EVDEV_RELATIVE_EVENTS)
+ mode = Relative;
+ else {
+ xf86IDrvMsg(pInfo, X_ERROR, "BUG: mode is neither absolute nor relative\n");
+ mode = Absolute;
+ }
+
+ EvdevInitAxesLabels(pEvdev, mode, pEvdev->num_vals, atoms);
XIChangeDeviceProperty(dev, prop_axis_label, XA_ATOM, 32,
PropModeReplace, pEvdev->num_vals, atoms, FALSE);
XISetDevicePropertyDeletable(dev, prop_axis_label, FALSE);