summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2015-03-13 10:58:01 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2015-03-13 10:58:01 +1000
commitfdc33809de2751c164183df2310a71732be579f3 (patch)
tree1851d18edf5bddf60cfa57acffb1ae4d7c0bb5a2
parent38e107a39fb4a0b630ee5adb5870c91dbc27abde (diff)
Invert a condition to reduce nesting
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/evdev.c b/src/evdev.c
index 639e4a1..360bbb8 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2759,22 +2759,22 @@ static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
for (button = BTN_MISC; button < BTN_JOYSTICK; button++)
{
- if (libevdev_has_event_code(pEvdev->dev, EV_KEY, button))
- {
- int group = (button % 0x100)/16;
- int idx = button - ((button/16) * 16);
+ int group = (button % 0x100)/16;
+ int idx = button - ((button/16) * 16);
+
+ if (!libevdev_has_event_code(pEvdev->dev, EV_KEY, button))
+ continue;
- if (!btn_labels[group][idx])
- continue;
+ if (!btn_labels[group][idx])
+ continue;
- atom = XIGetKnownProperty(btn_labels[group][idx]);
- if (!atom)
- continue;
+ atom = XIGetKnownProperty(btn_labels[group][idx]);
+ if (!atom)
+ continue;
- /* Props are 0-indexed, button numbers start with 1 */
- bmap = EvdevUtilButtonEventToButtonNumber(pEvdev, button) - 1;
- atoms[bmap] = atom;
- }
+ /* Props are 0-indexed, button numbers start with 1 */
+ bmap = EvdevUtilButtonEventToButtonNumber(pEvdev, button) - 1;
+ atoms[bmap] = atom;
}
/* wheel buttons, hardcoded anyway */