diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-29 09:25:43 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-06-15 16:05:16 +1000 |
commit | b0e3c8f97809c8e323783ded0d308c6f0b7729ff (patch) | |
tree | d88b767f98f85eea5844a3d732e22dad102ce492 /src | |
parent | Constify InputDriverRec->default_options (diff) | |
download | xf86-input-evdev-b0e3c8f97809c8e323783ded0d308c6f0b7729ff.tar.gz xf86-input-evdev-b0e3c8f97809c8e323783ded0d308c6f0b7729ff.tar.bz2 xf86-input-evdev-b0e3c8f97809c8e323783ded0d308c6f0b7729ff.zip |
Split initializing one axis label out into a helper function
We need this for mixed axis devices. No functional changes.
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.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/evdev.c b/src/evdev.c index 000eccc..df85c9f 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -122,6 +122,8 @@ static int EvdevOpenDevice(InputInfoPtr pInfo); static void EvdevCloseDevice(InputInfoPtr pInfo); static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms); +static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int axis, + const char **labels, int label_idx, Atom *atoms); static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms); static void EvdevInitProperty(DeviceIntPtr dev); static int EvdevSetProperty(DeviceIntPtr dev, Atom atom, @@ -2719,9 +2721,23 @@ static const char *btn_labels[][16] = { } }; -static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms) +static void EvdevInitOneAxisLabel(EvdevPtr pEvdev, int axis, + const char **labels, int label_idx, Atom *atoms) { Atom atom; + + if (pEvdev->axis_map[axis] == -1) + return; + + atom = XIGetKnownProperty(labels[label_idx]); + if (!atom) /* Should not happen */ + return; + + atoms[pEvdev->axis_map[axis]] = atom; +} + +static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *atoms) +{ int axis; const char **labels; int labels_len = 0; @@ -2741,16 +2757,7 @@ static void EvdevInitAxesLabels(EvdevPtr pEvdev, int mode, int natoms, Atom *ato /* Now fill the ones we know */ for (axis = 0; axis < labels_len; axis++) - { - if (pEvdev->axis_map[axis] == -1) - continue; - - atom = XIGetKnownProperty(labels[axis]); - if (!atom) /* Should not happen */ - continue; - - atoms[pEvdev->axis_map[axis]] = atom; - } + EvdevInitOneAxisLabel(pEvdev, axis, labels, axis, atoms); } static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms) |