From fdc33809de2751c164183df2310a71732be579f3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 13 Mar 2015 10:58:01 +1000 Subject: Invert a condition to reduce nesting Signed-off-by: Peter Hutterer --- src/evdev.c | 26 +++++++++++++------------- 1 file 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 */ -- cgit v1.2.3