From dd02daedca0516d1d57f27f2916e21aa4cb58b87 Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Sun, 3 May 2026 03:03:23 +0900 Subject: [PATCH] src/input/keyboard.c: use switch instead of if --- src/input/keyboard.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/input/keyboard.c b/src/input/keyboard.c index 98be5d11..ff38fb0d 100644 --- a/src/input/keyboard.c +++ b/src/input/keyboard.c @@ -467,19 +467,18 @@ handle_cycle_view_key(struct keyinfo *keyinfo) /* cycle to next */ for (int i = 0; i < keyinfo->translated.nr_syms; i++) { - if (keyinfo->translated.syms[i] == XKB_KEY_Escape) { + switch (keyinfo->translated.syms[i]) { + case XKB_KEY_Escape: /* Esc deactivates window switcher */ cycle_finish(/*switch_focus*/ false); return true; - } - if (keyinfo->translated.syms[i] == XKB_KEY_Up - || keyinfo->translated.syms[i] == XKB_KEY_Left) { + case XKB_KEY_Up: + case XKB_KEY_Left: /* Up/Left cycles the window backward */ cycle_step(LAB_CYCLE_DIR_BACKWARD); return true; - } - if (keyinfo->translated.syms[i] == XKB_KEY_Down - || keyinfo->translated.syms[i] == XKB_KEY_Right) { + case XKB_KEY_Down: + case XKB_KEY_Right: /* Down/Right cycles the window forward */ cycle_step(LAB_CYCLE_DIR_FORWARD); return true;