]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/common/action_layer.c
Merge pull request #355 from papodaca/XT
[max/tmk_keyboard.git] / tmk_core / common / action_layer.c
index c535615f44d44a8fa669e1f86825142b9c56b616..95909cc28617188be248d333c066e40b81f591fc 100644 (file)
@@ -3,6 +3,7 @@
 #include "action.h"
 #include "util.h"
 #include "action_layer.h"
+#include "hook.h"
 
 #ifdef DEBUG_ACTION
 #include "debug.h"
@@ -21,6 +22,7 @@ static void default_layer_state_set(uint32_t state)
     debug("default_layer_state: ");
     default_layer_debug(); debug(" to ");
     default_layer_state = state;
+    hook_default_layer_change(default_layer_state);
     default_layer_debug(); debug("\n");
     clear_keyboard_but_mods(); // To avoid stuck keys
 }
@@ -62,6 +64,7 @@ static void layer_state_set(uint32_t state)
     dprint("layer_state: ");
     layer_debug(); dprint(" to ");
     layer_state = state;
+    hook_layer_change(layer_state);
     layer_debug(); dprintln();
     clear_keyboard_but_mods(); // To avoid stuck keys
 }
@@ -114,8 +117,7 @@ void layer_debug(void)
 
 action_t layer_switch_get_action(keypos_t key)
 {
-    action_t action;
-    action.code = ACTION_TRANSPARENT;
+    action_t action = { .code = ACTION_TRANSPARENT };
 
 #ifndef NO_ACTION_LAYER
     uint32_t layers = layer_state | default_layer_state;