diff options
author | QMK Bot <hello@qmk.fm> | 2022-02-21 09:44:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 17:44:27 +0000 |
commit | 2f0dc0fb6d36b43e0d143224e4a9058b77c4e0e3 (patch) | |
tree | ecdbdccbb5fde38e22f6228f6a20a4ca2fed8b99 /quantum | |
parent | 32903779181c31244c7c7b97a04bda0fd5b59de1 (diff) | |
download | qmk_firmware-2f0dc0fb6d36b43e0d143224e4a9058b77c4e0e3.tar.gz qmk_firmware-2f0dc0fb6d36b43e0d143224e4a9058b77c4e0e3.zip |
Format code according to conventions (#16419)
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/action.c | 83 | ||||
-rw-r--r-- | quantum/action.h | 2 |
2 files changed, 39 insertions, 46 deletions
diff --git a/quantum/action.c b/quantum/action.c index 5e81efb67..7a330b05c 100644 --- a/quantum/action.c +++ b/quantum/action.c | |||
@@ -834,10 +834,9 @@ void register_code(uint8_t code) { | |||
834 | } | 834 | } |
835 | #endif | 835 | #endif |
836 | 836 | ||
837 | else if | 837 | else if IS_KEY (code) { |
838 | IS_KEY(code) { | 838 | // TODO: should push command_proc out of this block? |
839 | // TODO: should push command_proc out of this block? | 839 | if (command_proc(code)) return; |
840 | if (command_proc(code)) return; | ||
841 | 840 | ||
842 | #ifndef NO_ACTION_ONESHOT | 841 | #ifndef NO_ACTION_ONESHOT |
843 | /* TODO: remove | 842 | /* TODO: remove |
@@ -854,35 +853,33 @@ void register_code(uint8_t code) { | |||
854 | } else | 853 | } else |
855 | */ | 854 | */ |
856 | #endif | 855 | #endif |
857 | { | 856 | { |
858 | // Force a new key press if the key is already pressed | 857 | // Force a new key press if the key is already pressed |
859 | // without this, keys with the same keycode, but different | 858 | // without this, keys with the same keycode, but different |
860 | // modifiers will be reported incorrectly, see issue #1708 | 859 | // modifiers will be reported incorrectly, see issue #1708 |
861 | if (is_key_pressed(keyboard_report, code)) { | 860 | if (is_key_pressed(keyboard_report, code)) { |
862 | del_key(code); | 861 | del_key(code); |
863 | send_keyboard_report(); | ||
864 | } | ||
865 | add_key(code); | ||
866 | send_keyboard_report(); | 862 | send_keyboard_report(); |
867 | } | 863 | } |
868 | } | 864 | add_key(code); |
869 | else if | ||
870 | IS_MOD(code) { | ||
871 | add_mods(MOD_BIT(code)); | ||
872 | send_keyboard_report(); | 865 | send_keyboard_report(); |
873 | } | 866 | } |
867 | } else if IS_MOD (code) { | ||
868 | add_mods(MOD_BIT(code)); | ||
869 | send_keyboard_report(); | ||
870 | } | ||
874 | #ifdef EXTRAKEY_ENABLE | 871 | #ifdef EXTRAKEY_ENABLE |
875 | else if | 872 | else if IS_SYSTEM (code) { |
876 | IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } | 873 | host_system_send(KEYCODE2SYSTEM(code)); |
877 | else if | 874 | } else if IS_CONSUMER (code) { |
878 | IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } | 875 | host_consumer_send(KEYCODE2CONSUMER(code)); |
876 | } | ||
879 | #endif | 877 | #endif |
880 | #ifdef MOUSEKEY_ENABLE | 878 | #ifdef MOUSEKEY_ENABLE |
881 | else if | 879 | else if IS_MOUSEKEY (code) { |
882 | IS_MOUSEKEY(code) { | 880 | mousekey_on(code); |
883 | mousekey_on(code); | 881 | mousekey_send(); |
884 | mousekey_send(); | 882 | } |
885 | } | ||
886 | #endif | 883 | #endif |
887 | } | 884 | } |
888 | 885 | ||
@@ -927,26 +924,22 @@ void unregister_code(uint8_t code) { | |||
927 | } | 924 | } |
928 | #endif | 925 | #endif |
929 | 926 | ||
930 | else if | 927 | else if IS_KEY (code) { |
931 | IS_KEY(code) { | 928 | del_key(code); |
932 | del_key(code); | 929 | send_keyboard_report(); |
933 | send_keyboard_report(); | 930 | } else if IS_MOD (code) { |
934 | } | 931 | del_mods(MOD_BIT(code)); |
935 | else if | 932 | send_keyboard_report(); |
936 | IS_MOD(code) { | 933 | } else if IS_SYSTEM (code) { |
937 | del_mods(MOD_BIT(code)); | 934 | host_system_send(0); |
938 | send_keyboard_report(); | 935 | } else if IS_CONSUMER (code) { |
939 | } | 936 | host_consumer_send(0); |
940 | else if | 937 | } |
941 | IS_SYSTEM(code) { host_system_send(0); } | ||
942 | else if | ||
943 | IS_CONSUMER(code) { host_consumer_send(0); } | ||
944 | #ifdef MOUSEKEY_ENABLE | 938 | #ifdef MOUSEKEY_ENABLE |
945 | else if | 939 | else if IS_MOUSEKEY (code) { |
946 | IS_MOUSEKEY(code) { | 940 | mousekey_off(code); |
947 | mousekey_off(code); | 941 | mousekey_send(); |
948 | mousekey_send(); | 942 | } |
949 | } | ||
950 | #endif | 943 | #endif |
951 | } | 944 | } |
952 | 945 | ||
diff --git a/quantum/action.h b/quantum/action.h index b562f18c5..8a357ded8 100644 --- a/quantum/action.h +++ b/quantum/action.h | |||
@@ -88,7 +88,7 @@ extern bool disable_action_cache; | |||
88 | 88 | ||
89 | /* Code for handling one-handed key modifiers. */ | 89 | /* Code for handling one-handed key modifiers. */ |
90 | #ifdef SWAP_HANDS_ENABLE | 90 | #ifdef SWAP_HANDS_ENABLE |
91 | extern bool swap_hands; | 91 | extern bool swap_hands; |
92 | extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS]; | 92 | extern const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS]; |
93 | # if (MATRIX_COLS <= 8) | 93 | # if (MATRIX_COLS <= 8) |
94 | typedef uint8_t swap_state_row_t; | 94 | typedef uint8_t swap_state_row_t; |