diff options
Diffstat (limited to 'tmk_core/common/action.c')
| -rw-r--r-- | tmk_core/common/action.c | 48 | 
1 files changed, 45 insertions, 3 deletions
| diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index f7c039f457..ec8d6ed7b9 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -120,7 +120,7 @@ void process_hand_swap(keyevent_t *event) {  }  #endif -#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) +#if !defined(NO_ACTION_LAYER) && !defined(STRICT_LAYER_RELEASE)  bool disable_action_cache = false;  void process_record_nocache(keyrecord_t *record) @@ -653,7 +653,7 @@ void process_action(keyrecord_t *record, action_t action)  #ifndef NO_ACTION_TAPPING    #ifdef RETRO_TAPPING -  if (!is_tap_key(record->event.key)) { +  if (!is_tap_action(action)) {      retro_tapping_counter = 0;    } else {      if (event.pressed) { @@ -773,6 +773,13 @@ void register_code(uint8_t code)      else if IS_CONSUMER(code) {          host_consumer_send(KEYCODE2CONSUMER(code));      } + +    #ifdef MOUSEKEY_ENABLE +      else if IS_MOUSEKEY(code) { +        mousekey_on(code); +        mousekey_send(); +      } +    #endif  }  /** \brief Utilities for actions. (FIXME: Needs better description) @@ -832,6 +839,24 @@ void unregister_code(uint8_t code)      else if IS_CONSUMER(code) {          host_consumer_send(0);      } +    #ifdef MOUSEKEY_ENABLE +      else if IS_MOUSEKEY(code) { +        mousekey_off(code); +        mousekey_send(); +      } +    #endif +} + +/** \brief Utilities for actions. (FIXME: Needs better description) + * + * FIXME: Needs documentation. + */ +void tap_code(uint8_t code) { +  register_code(code); +  #if TAP_CODE_DELAY > 0 +    wait_ms(TAP_CODE_DELAY); +  #endif +  unregister_code(code);  }  /** \brief Utilities for actions. (FIXME: Needs better description) @@ -874,9 +899,18 @@ void clear_keyboard(void)   */  void clear_keyboard_but_mods(void)  { +    clear_keys(); +    clear_keyboard_but_mods_and_keys(); +} + +/** \brief Utilities for actions. (FIXME: Needs better description) + * + * FIXME: Needs documentation. + */ +void clear_keyboard_but_mods_and_keys() +{      clear_weak_mods();      clear_macro_mods(); -    clear_keys();      send_keyboard_report();  #ifdef MOUSEKEY_ENABLE      mousekey_clear(); @@ -895,7 +929,15 @@ void clear_keyboard_but_mods(void)  bool is_tap_key(keypos_t key)  {      action_t action = layer_switch_get_action(key); +    return is_tap_action(action); +} +/** \brief Utilities for actions. (FIXME: Needs better description) + * + * FIXME: Needs documentation. + */ +bool is_tap_action(action_t action) +{      switch (action.kind.id) {          case ACT_LMODS_TAP:          case ACT_RMODS_TAP: | 
