diff options
Diffstat (limited to 'quantum/action.c')
-rw-r--r-- | quantum/action.c | 83 |
1 files changed, 45 insertions, 38 deletions
diff --git a/quantum/action.c b/quantum/action.c index 8c34b84ef..5c33bd6d2 100644 --- a/quantum/action.c +++ b/quantum/action.c | |||
@@ -821,9 +821,10 @@ void register_code(uint8_t code) { | |||
821 | } | 821 | } |
822 | #endif | 822 | #endif |
823 | 823 | ||
824 | else if IS_KEY (code) { | 824 | else if |
825 | // TODO: should push command_proc out of this block? | 825 | IS_KEY(code) { |
826 | if (command_proc(code)) return; | 826 | // TODO: should push command_proc out of this block? |
827 | if (command_proc(code)) return; | ||
827 | 828 | ||
828 | #ifndef NO_ACTION_ONESHOT | 829 | #ifndef NO_ACTION_ONESHOT |
829 | /* TODO: remove | 830 | /* TODO: remove |
@@ -840,33 +841,35 @@ void register_code(uint8_t code) { | |||
840 | } else | 841 | } else |
841 | */ | 842 | */ |
842 | #endif | 843 | #endif |
843 | { | 844 | { |
844 | // Force a new key press if the key is already pressed | 845 | // Force a new key press if the key is already pressed |
845 | // without this, keys with the same keycode, but different | 846 | // without this, keys with the same keycode, but different |
846 | // modifiers will be reported incorrectly, see issue #1708 | 847 | // modifiers will be reported incorrectly, see issue #1708 |
847 | if (is_key_pressed(keyboard_report, code)) { | 848 | if (is_key_pressed(keyboard_report, code)) { |
848 | del_key(code); | 849 | del_key(code); |
850 | send_keyboard_report(); | ||
851 | } | ||
852 | add_key(code); | ||
849 | send_keyboard_report(); | 853 | send_keyboard_report(); |
850 | } | 854 | } |
851 | add_key(code); | 855 | } |
856 | else if | ||
857 | IS_MOD(code) { | ||
858 | add_mods(MOD_BIT(code)); | ||
852 | send_keyboard_report(); | 859 | send_keyboard_report(); |
853 | } | 860 | } |
854 | } else if IS_MOD (code) { | ||
855 | add_mods(MOD_BIT(code)); | ||
856 | send_keyboard_report(); | ||
857 | } | ||
858 | #ifdef EXTRAKEY_ENABLE | 861 | #ifdef EXTRAKEY_ENABLE |
859 | else if IS_SYSTEM (code) { | 862 | else if |
860 | host_system_send(KEYCODE2SYSTEM(code)); | 863 | IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } |
861 | } else if IS_CONSUMER (code) { | 864 | else if |
862 | host_consumer_send(KEYCODE2CONSUMER(code)); | 865 | IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } |
863 | } | ||
864 | #endif | 866 | #endif |
865 | #ifdef MOUSEKEY_ENABLE | 867 | #ifdef MOUSEKEY_ENABLE |
866 | else if IS_MOUSEKEY (code) { | 868 | else if |
867 | mousekey_on(code); | 869 | IS_MOUSEKEY(code) { |
868 | mousekey_send(); | 870 | mousekey_on(code); |
869 | } | 871 | mousekey_send(); |
872 | } | ||
870 | #endif | 873 | #endif |
871 | } | 874 | } |
872 | 875 | ||
@@ -911,22 +914,26 @@ void unregister_code(uint8_t code) { | |||
911 | } | 914 | } |
912 | #endif | 915 | #endif |
913 | 916 | ||
914 | else if IS_KEY (code) { | 917 | else if |
915 | del_key(code); | 918 | IS_KEY(code) { |
916 | send_keyboard_report(); | 919 | del_key(code); |
917 | } else if IS_MOD (code) { | 920 | send_keyboard_report(); |
918 | del_mods(MOD_BIT(code)); | 921 | } |
919 | send_keyboard_report(); | 922 | else if |
920 | } else if IS_SYSTEM (code) { | 923 | IS_MOD(code) { |
921 | host_system_send(0); | 924 | del_mods(MOD_BIT(code)); |
922 | } else if IS_CONSUMER (code) { | 925 | send_keyboard_report(); |
923 | host_consumer_send(0); | 926 | } |
924 | } | 927 | else if |
928 | IS_SYSTEM(code) { host_system_send(0); } | ||
929 | else if | ||
930 | IS_CONSUMER(code) { host_consumer_send(0); } | ||
925 | #ifdef MOUSEKEY_ENABLE | 931 | #ifdef MOUSEKEY_ENABLE |
926 | else if IS_MOUSEKEY (code) { | 932 | else if |
927 | mousekey_off(code); | 933 | IS_MOUSEKEY(code) { |
928 | mousekey_send(); | 934 | mousekey_off(code); |
929 | } | 935 | mousekey_send(); |
936 | } | ||
930 | #endif | 937 | #endif |
931 | } | 938 | } |
932 | 939 | ||