aboutsummaryrefslogtreecommitdiff
path: root/common/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/action.c')
-rw-r--r--common/action.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/common/action.c b/common/action.c
index 15e125a3e..4fafbfa79 100644
--- a/common/action.c
+++ b/common/action.c
@@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
23#include "command.h" 23#include "command.h"
24#include "util.h" 24#include "util.h"
25#include "debug.h" 25#include "debug.h"
26#include "led.h"
26#include "layer_switch.h" 27#include "layer_switch.h"
27#include "action_macro.h" 28#include "action_macro.h"
28#include "action.h" 29#include "action.h"
@@ -889,6 +890,18 @@ void register_code(uint8_t code)
889 if (code == KC_NO) { 890 if (code == KC_NO) {
890 return; 891 return;
891 } 892 }
893#ifdef CAPSLOCK_LOCKING_ENABLE
894 else if (KC_LOCKING_CAPS == code) {
895#ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
896 // Resync: ignore if caps lock already is on
897 if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) return;
898#endif
899 host_add_key(KC_CAPSLOCK);
900 host_send_keyboard_report();
901 host_del_key(KC_CAPSLOCK);
902 host_send_keyboard_report();
903 }
904#endif
892 else if IS_KEY(code) { 905 else if IS_KEY(code) {
893 // TODO: should push command_proc out of this block? 906 // TODO: should push command_proc out of this block?
894 if (command_proc(code)) return; 907 if (command_proc(code)) return;
@@ -914,7 +927,22 @@ void register_code(uint8_t code)
914 927
915void unregister_code(uint8_t code) 928void unregister_code(uint8_t code)
916{ 929{
917 if IS_KEY(code) { 930 if (code == KC_NO) {
931 return;
932 }
933#ifdef CAPSLOCK_LOCKING_ENABLE
934 else if (KC_LOCKING_CAPS == code) {
935#ifdef CAPSLOCK_LOCKING_RESYNC_ENABLE
936 // Resync: ignore if caps lock already is off
937 if (!(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) return;
938#endif
939 host_add_key(KC_CAPSLOCK);
940 host_send_keyboard_report();
941 host_del_key(KC_CAPSLOCK);
942 host_send_keyboard_report();
943 }
944#endif
945 else if IS_KEY(code) {
918 host_del_key(code); 946 host_del_key(code);
919 host_send_keyboard_report(); 947 host_send_keyboard_report();
920 } 948 }