summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Đorđević <vomindoraan@gmail.com>2019-02-16 18:05:01 +0100
committerKonstantin Đorđević <vomindoraan@gmail.com>2019-03-02 15:15:57 +0100
commit784e2af062a9ef0c6d1a4ef7fcc20df79ad4fab1 (patch)
tree03e52cf0eefeabc991275afb748fe6fa87861ccb
parentbe65a0cc7921a0f6a6397bd7682720b5bd7d9128 (diff)
downloadqmk_firmware-784e2af062a9ef0c6d1a4ef7fcc20df79ad4fab1.tar.gz
qmk_firmware-784e2af062a9ef0c6d1a4ef7fcc20df79ad4fab1.zip
Make toggle_numpad a nested function in process_record_user
-rw-r--r--users/konstantin/konstantin.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/users/konstantin/konstantin.c b/users/konstantin/konstantin.c
index f5c59f9eb1..a567d9166f 100644
--- a/users/konstantin/konstantin.c
+++ b/users/konstantin/konstantin.c
@@ -40,22 +40,21 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
return true;
}
-#ifdef LAYER_NUMPAD
-static void toggle_numpad(void) {
- layer_invert(L_NUMPAD);
- bool numpad_on = IS_LAYER_ON(L_NUMPAD);
- bool num_lock_on = IS_HOST_LED_ON(USB_LED_NUM_LOCK);
- if (num_lock_on != numpad_on) {
- tap_code(KC_NLCK); // Toggle Num Lock to match layer state
- }
-}
-#endif
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
if (!process_record_keymap(keycode, record)) {
return false;
}
+#ifdef LAYER_NUMPAD
+ void toggle_numpad(void) {
+ layer_invert(L_NUMPAD);
+ bool numpad = IS_LAYER_ON(L_NUMPAD), num_lock = IS_HOST_LED_ON(USB_LED_NUM_LOCK);
+ if (num_lock != numpad) {
+ tap_code(KC_NLCK); // Toggle Num Lock to match layer state
+ }
+ }
+#endif
+
switch (keycode) {
case CLEAR:
if (record->event.pressed) {