From 001bc280377d30341692ef973c607593a6217461 Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Sat, 22 Aug 2009 02:55:45 +0200 Subject: [PATCH] swpanel: Factor out if (swpanel) test We can remove redundand tests in each "case:" inside the switch if we do it in the beginning. --- src/cycling.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/cycling.c b/src/cycling.c index 9108fa68..1f7189b2 100644 --- a/src/cycling.c +++ b/src/cycling.c @@ -142,13 +142,12 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next) /* ignore CapsLock */ modifiers = ev.xkey.state & ValidModMask; - switch (ev.type) { - case KeyPress: + if (!swpanel) + done = True; - if (!swpanel) { - done = True; - break; - } + switch (ev.type) { + + case KeyPress: if ((wKeyBindings[WKBD_FOCUSNEXT].keycode == ev.xkey.keycode && wKeyBindings[WKBD_FOCUSNEXT].modifier == modifiers) @@ -197,19 +196,20 @@ void StartWindozeCycle(WWindow * wwin, XEvent * event, Bool next) break; case EnterNotify: + /* ignore unwanted EnterNotify's */ break; case LeaveNotify: case MotionNotify: - case ButtonRelease: - if (swpanel) { - newFocused = wSwitchPanelHandleEvent(swpanel, &ev); - oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); - if (ev.type == ButtonRelease) - done = True; - } + case ButtonRelease: + + newFocused = wSwitchPanelHandleEvent(swpanel, &ev); + oldFocused = change_focus_and_raise(newFocused, oldFocused, swpanel, scr); + + if (ev.type == ButtonRelease) + done = True; break; default: