diff options
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index f41665b06..bd41d28b6 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c | |||
@@ -773,10 +773,9 @@ void register_code(uint8_t code) { | |||
773 | } | 773 | } |
774 | #endif | 774 | #endif |
775 | 775 | ||
776 | else if | 776 | else if IS_KEY (code) { |
777 | IS_KEY(code) { | 777 | // TODO: should push command_proc out of this block? |
778 | // TODO: should push command_proc out of this block? | 778 | if (command_proc(code)) return; |
779 | if (command_proc(code)) return; | ||
780 | 779 | ||
781 | #ifndef NO_ACTION_ONESHOT | 780 | #ifndef NO_ACTION_ONESHOT |
782 | /* TODO: remove | 781 | /* TODO: remove |
@@ -793,35 +792,33 @@ void register_code(uint8_t code) { | |||
793 | } else | 792 | } else |
794 | */ | 793 | */ |
795 | #endif | 794 | #endif |
796 | { | 795 | { |
797 | // Force a new key press if the key is already pressed | 796 | // Force a new key press if the key is already pressed |
798 | // without this, keys with the same keycode, but different | 797 | // without this, keys with the same keycode, but different |
799 | // modifiers will be reported incorrectly, see issue #1708 | 798 | // modifiers will be reported incorrectly, see issue #1708 |
800 | if (is_key_pressed(keyboard_report, code)) { | 799 | if (is_key_pressed(keyboard_report, code)) { |
801 | del_key(code); | 800 | del_key(code); |
802 | send_keyboard_report(); | ||
803 | } | ||
804 | add_key(code); | ||
805 | send_keyboard_report(); | 801 | send_keyboard_report(); |
806 | } | 802 | } |
807 | } | 803 | add_key(code); |
808 | else if | ||
809 | IS_MOD(code) { | ||
810 | add_mods(MOD_BIT(code)); | ||
811 | send_keyboard_report(); | 804 | send_keyboard_report(); |
812 | } | 805 | } |
806 | } else if IS_MOD (code) { | ||
807 | add_mods(MOD_BIT(code)); | ||
808 | send_keyboard_report(); | ||
809 | } | ||
813 | #ifdef EXTRAKEY_ENABLE | 810 | #ifdef EXTRAKEY_ENABLE |
814 | else if | 811 | else if IS_SYSTEM (code) { |
815 | IS_SYSTEM(code) { host_system_send(KEYCODE2SYSTEM(code)); } | 812 | host_system_send(KEYCODE2SYSTEM(code)); |
816 | else if | 813 | } else if IS_CONSUMER (code) { |
817 | IS_CONSUMER(code) { host_consumer_send(KEYCODE2CONSUMER(code)); } | 814 | host_consumer_send(KEYCODE2CONSUMER(code)); |
815 | } | ||
818 | #endif | 816 | #endif |
819 | #ifdef MOUSEKEY_ENABLE | 817 | #ifdef MOUSEKEY_ENABLE |
820 | else if | 818 | else if IS_MOUSEKEY (code) { |
821 | IS_MOUSEKEY(code) { | 819 | mousekey_on(code); |
822 | mousekey_on(code); | 820 | mousekey_send(); |
823 | mousekey_send(); | 821 | } |
824 | } | ||
825 | #endif | 822 | #endif |
826 | } | 823 | } |
827 | 824 | ||
@@ -866,26 +863,22 @@ void unregister_code(uint8_t code) { | |||
866 | } | 863 | } |
867 | #endif | 864 | #endif |
868 | 865 | ||
869 | else if | 866 | else if IS_KEY (code) { |
870 | IS_KEY(code) { | 867 | del_key(code); |
871 | del_key(code); | 868 | send_keyboard_report(); |
872 | send_keyboard_report(); | 869 | } else if IS_MOD (code) { |
873 | } | 870 | del_mods(MOD_BIT(code)); |
874 | else if | 871 | send_keyboard_report(); |
875 | IS_MOD(code) { | 872 | } else if IS_SYSTEM (code) { |
876 | del_mods(MOD_BIT(code)); | 873 | host_system_send(0); |
877 | send_keyboard_report(); | 874 | } else if IS_CONSUMER (code) { |
878 | } | 875 | host_consumer_send(0); |
879 | else if | 876 | } |
880 | IS_SYSTEM(code) { host_system_send(0); } | ||
881 | else if | ||
882 | IS_CONSUMER(code) { host_consumer_send(0); } | ||
883 | #ifdef MOUSEKEY_ENABLE | 877 | #ifdef MOUSEKEY_ENABLE |
884 | else if | 878 | else if IS_MOUSEKEY (code) { |
885 | IS_MOUSEKEY(code) { | 879 | mousekey_off(code); |
886 | mousekey_off(code); | 880 | mousekey_send(); |
887 | mousekey_send(); | 881 | } |
888 | } | ||
889 | #endif | 882 | #endif |
890 | } | 883 | } |
891 | 884 | ||