]> git.mdlowis.com Git - proto/labwc.git/commit
keybind: refactor update_keycodes_iter() to reduce nesting
authorJohn Lindgren <john@jlindgren.net>
Sat, 16 Aug 2025 17:17:36 +0000 (13:17 -0400)
committerJohan Malm <johanmalm@users.noreply.github.com>
Mon, 18 Aug 2025 18:54:18 +0000 (19:54 +0100)
commit6574c82aedc8ce530af8c6a0ad8680ba6d7d1f4a
tree51669f7909836a9728b3052002d9bb7eeca2e0bf
parent28513cbdbed47c1dce19f376183d4e29fdca9ec6
keybind: refactor update_keycodes_iter() to reduce nesting

update_keycodes_iter() currently has 4(!) levels of nested loops, which
makes the logic (especially the break/continue statements) difficult to
understand. The logic also appears to continue looping uselessly after
a given keycode has already been added to a keybind.

Refactor by adding some small utility functions:

- keybind_contains_keycode()
- keybind_contains_keysym()
- keybind_contains_any_keysym()

No functional change intended.
include/config/keybind.h
src/config/keybind.c
src/input/keyboard.c