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 be135f18f..208690f5e 100644 --- a/quantum/action.c +++ b/quantum/action.c | |||
@@ -782,9 +782,10 @@ void register_code(uint8_t code) { | |||
782 | } | 782 | } |
783 | #endif | 783 | #endif |
784 | 784 | ||
785 | else if IS_KEY (code) { | 785 | else if |
786 | // TODO: should push command_proc out of this block? | 786 | IS_KEY(code) { |
787 | if (command_proc(code)) return; | 787 | // TODO: should push command_proc out of this block? |
788 | if (command_proc(code)) return; | ||
788 | 789 | ||
789 | #ifndef NO_ACTION_ONESHOT | 790 | #ifndef NO_ACTION_ONESHOT |
790 | /* TODO: remove | 791 | /* TODO: remove |
@@ -801,33 +802,35 @@ void register_code(uint8_t code) { | |||
801 | } else | 802 | } else |
802 | */ | 803 | */ |
803 | #endif | 804 | #endif |
804 | { | 805 | { |
805 | // Force a new key press if the key is already pressed | 806 | // Force a new key press if the key is already pressed |
806 | // without this, keys with the same keycode, but different | 807 | // without this, keys with the same keycode, but different |
807 | // modifiers will be reported incorrectly, see issue #1708 | 808 | // modifiers will be reported incorrectly, see issue #1708 |
808 | if (is_key_pressed(keyboard_report, code)) { | 809 | if (is_key_pressed(keyboard_report, code)) { |
809 | del_key(code); | 810 | del_key(code); |
811 | send_keyboard_report(); | ||
812 | } | ||
813 | add_key(code); | ||
810 | send_keyboard_report(); | 814 | send_keyboard_report(); |
811 | } | 815 | } |
812 | add_key(code); | 816 | } |
817 | else if | ||
818 | IS_MOD(code) { | ||
819 | add_mods(MOD_BIT(code)); | ||
813 | send_keyboard_report(); | 820 | send_keyboard_report(); |
814 | } | 821 | } |
815 | } else if IS_MOD (code) { | ||
816 | add_mods(MOD_BIT(code)); | ||
817 | send_keyboard_report(); | ||
818 | } | ||
819 | #ifdef EXTRAKEY_ENABLE | 822 | #ifdef EXTRAKEY_ENABLE |
820 | else if IS_SYSTEM (code) { | 823 | else if |
821 | host_system_send(KEYCODE2SYSTEM(code)); | 824 | IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } |
822 | } else if IS_CONSUMER (code) { | 825 | else if |
823 | host_consumer_send(KEYCODE2CONSUMER(code)); | 826 | IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } |
824 | } | ||
825 | #endif | 827 | #endif |
826 | #ifdef MOUSEKEY_ENABLE | 828 | #ifdef MOUSEKEY_ENABLE |
827 | else if IS_MOUSEKEY (code) { | 829 | else if |
828 | mousekey_on(code); | 830 | IS_MOUSEKEY(code) { |
829 | mousekey_send(); | 831 | mousekey_on(code); |
830 | } | 832 | mousekey_send(); |
833 | } | ||
831 | #endif | 834 | #endif |
832 | } | 835 | } |
833 | 836 | ||
@@ -872,22 +875,26 @@ void unregister_code(uint8_t code) { | |||
872 | } | 875 | } |
873 | #endif | 876 | #endif |
874 | 877 | ||
875 | else if IS_KEY (code) { | 878 | else if |
876 | del_key(code); | 879 | IS_KEY(code) { |
877 | send_keyboard_report(); | 880 | del_key(code); |
878 | } else if IS_MOD (code) { | 881 | send_keyboard_report(); |
879 | del_mods(MOD_BIT(code)); | 882 | } |
880 | send_keyboard_report(); | 883 | else if |
881 | } else if IS_SYSTEM (code) { | 884 | IS_MOD(code) { |
882 | host_system_send(0); | 885 | del_mods(MOD_BIT(code)); |
883 | } else if IS_CONSUMER (code) { | 886 | send_keyboard_report(); |
884 | host_consumer_send(0); | 887 | } |
885 | } | 888 | else if |
889 | IS_SYSTEM(code) { host_system_send(0); } | ||
890 | else if | ||
891 | IS_CONSUMER(code) { host_consumer_send(0); } | ||
886 | #ifdef MOUSEKEY_ENABLE | 892 | #ifdef MOUSEKEY_ENABLE |
887 | else if IS_MOUSEKEY (code) { | 893 | else if |
888 | mousekey_off(code); | 894 | IS_MOUSEKEY(code) { |
889 | mousekey_send(); | 895 | mousekey_off(code); |
890 | } | 896 | mousekey_send(); |
897 | } | ||
891 | #endif | 898 | #endif |
892 | } | 899 | } |
893 | 900 | ||