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