]> git.friedersdorff.com Git - max/tmk_keyboard.git/blobdiff - tmk_core/common/action.c
Merge pull request #36 from squarefrog/colemak
[max/tmk_keyboard.git] / tmk_core / common / action.c
index ec8eeae7bc8b7bfb6f8e372ce9acc097b4351948..b9040f5b7c6cbf0b45820625193f80af2ee270f7 100644 (file)
@@ -26,6 +26,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "action_macro.h"
 #include "action_util.h"
 #include "action.h"
+#include "hook.h"
 
 #ifdef DEBUG_ACTION
 #include "debug.h"
@@ -39,6 +40,7 @@ void action_exec(keyevent_t event)
     if (!IS_NOEVENT(event)) {
         dprint("\n---- action_exec: start -----\n");
         dprint("EVENT: "); debug_event(event); dprintln();
+        hook_matrix_change(event);
     }
 
     keyrecord_t record = { .event = event };
@@ -131,10 +133,17 @@ void process_action(keyrecord_t *record)
                     case MODS_TAP_TOGGLE:
                         if (event.pressed) {
                             if (tap_count <= TAPPING_TOGGLE) {
-                                register_mods(mods);
+                                if (mods & get_mods()) {
+                                    dprint("MODS_TAP_TOGGLE: toggle mods off\n");
+                                    unregister_mods(mods);
+                                } else {
+                                    dprint("MODS_TAP_TOGGLE: toggle mods on\n");
+                                    register_mods(mods);
+                                }
                             }
                         } else {
                             if (tap_count < TAPPING_TOGGLE) {
+                                dprint("MODS_TAP_TOGGLE: release : unregister_mods\n");
                                 unregister_mods(mods);
                             }
                         }
@@ -518,7 +527,12 @@ bool is_tap_key(keypos_t key)
         case ACT_RMODS_TAP:
         case ACT_LAYER_TAP:
         case ACT_LAYER_TAP_EXT:
-            return true;
+            switch (action.layer_tap.code) {
+                case 0x00 ... 0xdf:
+                case OP_TAP_TOGGLE:
+                    return true;
+            }
+            return false;
         case ACT_MACRO:
         case ACT_FUNCTION:
             if (action.func.opt & FUNC_TAP) { return true; }