]> git.donarmstrong.com Git - tmk_firmware.git/blobdiff - common/action.c
Merge branch 'rhaberkorn-serial-mouse'
[tmk_firmware.git] / common / action.c
index ecd5a7e94f8840d1c54e0a79f72f2669d2b23df4..fddb97c508dbd96865c73ef08bfd68cc1739b1ac 100644 (file)
@@ -100,45 +100,45 @@ void process_action(keyrecord_t *record)
                                                                     action.key.mods<<4;
                 switch (action.layer_tap.code) {
     #ifndef NO_ACTION_ONESHOT
-                    case 0x00:
+                    case MODS_ONESHOT:
                         // Oneshot modifier
                         if (event.pressed) {
                             if (tap_count == 0) {
-                                dprint("MODS_TAP: Oneshot: add_mods\n");
                                 register_mods(mods);
                             }
                             else if (tap_count == 1) {
                                 dprint("MODS_TAP: Oneshot: start\n");
                                 set_oneshot_mods(mods);
                             }
-                            else if (tap_count == TAPPING_TOGGLE) {
-                                dprint("MODS_TAP: Oneshot: toggle\n");
-                                oneshot_toggle();
-                            }
                             else {
-                                dprint("MODS_TAP: Oneshot: cancel&add_mods\n");
-                                // double tap cancels oneshot and works as normal modifier.
-                                clear_oneshot_mods();
                                 register_mods(mods);
                             }
                         } else {
                             if (tap_count == 0) {
-                                dprint("MODS_TAP: Oneshot: cancel/del_mods\n");
-                                // cancel oneshot on hold
                                 clear_oneshot_mods();
                                 unregister_mods(mods);
                             }
                             else if (tap_count == 1) {
-                                // Oneshot
+                                // Retain Oneshot mods
                             }
                             else {
-                                dprint("MODS_TAP: Oneshot: del_mods\n");
-                                // cancel Mods
+                                clear_oneshot_mods();
                                 unregister_mods(mods);
                             }
                         }
                         break;
     #endif
+                    case MODS_TAP_TOGGLE:
+                        if (event.pressed) {
+                            if (tap_count <= TAPPING_TOGGLE) {
+                                register_mods(mods);
+                            }
+                        } else {
+                            if (tap_count < TAPPING_TOGGLE) {
+                                unregister_mods(mods);
+                            }
+                        }
+                        break;
                     default:
                         if (event.pressed) {
                             if (tap_count > 0) {
@@ -294,7 +294,7 @@ void process_action(keyrecord_t *record)
 #ifdef BACKLIGHT_ENABLE
         case ACT_BACKLIGHT:
             if (!event.pressed) {
-                switch (action.backlight.id) {
+                switch (action.backlight.opt) {
                     case BACKLIGHT_INCREASE:
                         backlight_increase();
                         break;
@@ -307,6 +307,9 @@ void process_action(keyrecord_t *record)
                     case BACKLIGHT_STEP:
                         backlight_step();
                         break;
+                    case BACKLIGHT_LEVEL:
+                        backlight_level(action.backlight.level);
+                        break;
                 }
             }
             break;
@@ -496,12 +499,6 @@ void clear_keyboard_but_mods(void)
 #endif
 }
 
-bool sending_anykey(void)
-{
-    return (has_anykey() || host_mouse_in_use() ||
-            host_last_sysytem_report() || host_last_consumer_report());
-}
-
 bool is_tap_key(key_t key)
 {
     action_t action = layer_switch_get_action(key);