summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-03-11 13:44:28 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-03-11 15:02:12 +1000
commitb6176cff5a3fbccc3708721958e9fb346518f57e (patch)
tree5385792b9247884fa6e107adfb4ea02e670998d4
parent37afebfb67609f04f9c1cdea983e7006ee2d59e5 (diff)
Invert two conditions to reduce nesting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/evdev.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/evdev.c b/src/evdev.c
index dacd3e3..7ce7405 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1180,22 +1180,22 @@ EvdevAddFakeSingleTouchAxes(InputInfoPtr pInfo)
{
int mt_code = mt_axis_mappings[i].mt_code;
int code = mt_axis_mappings[i].code;
+ const struct input_absinfo* abs;
- if (libevdev_has_event_code(pEvdev->dev, EV_ABS, mt_code) &&
- !libevdev_has_event_code(pEvdev->dev, EV_ABS, code))
+ if (!libevdev_has_event_code(pEvdev->dev, EV_ABS, mt_code) ||
+ libevdev_has_event_code(pEvdev->dev, EV_ABS, code))
+ continue;
+
+ abs = libevdev_get_abs_info(pEvdev->dev, mt_code);
+ if (libevdev_enable_event_code(pEvdev->dev, EV_ABS, code, abs))
{
- const struct input_absinfo* abs;
- abs = libevdev_get_abs_info(pEvdev->dev, mt_code);
- if (libevdev_enable_event_code(pEvdev->dev, EV_ABS, code, abs))
- {
- xf86IDrvMsg(pInfo, X_ERROR, "Failed to fake axis %s.\n",
- libevdev_event_code_get_name(EV_ABS, code));
- return -1;
- }
- xf86IDrvMsg(pInfo, X_INFO, "Faking axis %s.\n",
+ xf86IDrvMsg(pInfo, X_ERROR, "Failed to fake axis %s.\n",
libevdev_event_code_get_name(EV_ABS, code));
- num_axes++;
+ return -1;
}
+ xf86IDrvMsg(pInfo, X_INFO, "Faking axis %s.\n",
+ libevdev_event_code_get_name(EV_ABS, code));
+ num_axes++;
}
return num_axes;
@@ -1210,30 +1210,30 @@ EvdevCountMTAxes(EvdevPtr pEvdev, int *num_mt_axes_total,
/* Absolute multitouch axes: adjust mapping and axes counts. */
for (axis = ABS_MT_SLOT; axis < ABS_MAX; axis++)
{
- if (libevdev_has_event_code(pEvdev->dev, EV_ABS, axis))
- {
- int j;
- Bool skip = FALSE;
+ int j;
+ Bool skip = FALSE;
- /* Setup mapping if axis is in MT->legacy axis table. */
- for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
- {
- if (mt_axis_mappings[j].mt_code == axis &&
- libevdev_has_event_code(pEvdev->dev, EV_ABS, mt_axis_mappings[j].code))
- {
- mt_axis_mappings[j].needs_mapping = TRUE;
- skip = TRUE;
- }
- }
+ if (!libevdev_has_event_code(pEvdev->dev, EV_ABS, axis))
+ continue;
- if (!is_blacklisted_axis(axis))
+ /* Setup mapping if axis is in MT->legacy axis table. */
+ for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
+ {
+ if (mt_axis_mappings[j].mt_code == axis &&
+ libevdev_has_event_code(pEvdev->dev, EV_ABS, mt_axis_mappings[j].code))
{
- (*num_mt_axes_total)++;
- if (!skip)
- (*num_mt_axes)++;
+ mt_axis_mappings[j].needs_mapping = TRUE;
+ skip = TRUE;
}
- (*num_axes)--;
}
+
+ if (!is_blacklisted_axis(axis))
+ {
+ (*num_mt_axes_total)++;
+ if (!skip)
+ (*num_mt_axes)++;
+ }
+ (*num_axes)--;
}
}