diff options
Diffstat (limited to 'quantum/action.c')
| -rw-r--r-- | quantum/action.c | 74 | 
1 files changed, 32 insertions, 42 deletions
| diff --git a/quantum/action.c b/quantum/action.c index 7a330b05cd..3efed443a3 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -23,7 +23,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.  #include "led.h"  #include "action_layer.h"  #include "action_tapping.h" -#include "action_macro.h"  #include "action_util.h"  #include "action.h"  #include "wait.h" @@ -54,14 +53,20 @@ int retro_tapping_counter = 0;  #endif  #ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY -__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { +    return false; +}  #endif  #ifdef RETRO_TAPPING_PER_KEY -__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { return false; } +__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { +    return false; +}  #endif -__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { return true; } +__attribute__((weak)) bool pre_process_record_quantum(keyrecord_t *record) { +    return true; +}  /** \brief Called to execute an action.   * @@ -164,10 +169,14 @@ void process_record_nocache(keyrecord_t *record) {      disable_action_cache = false;  }  #else -void process_record_nocache(keyrecord_t *record) { process_record(record); } +void process_record_nocache(keyrecord_t *record) { +    process_record(record); +}  #endif -__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_record_quantum(keyrecord_t *record) { +    return true; +}  __attribute__((weak)) void post_process_record_quantum(keyrecord_t *record) {} @@ -634,12 +643,7 @@ void process_action(keyrecord_t *record, action_t action) {              break;  #    endif  #endif -            /* Extentions */ -#ifndef NO_ACTION_MACRO -        case ACT_MACRO: -            action_macro_play(action_get_macro(record, action.func.id, action.func.opt)); -            break; -#endif +  #ifdef SWAP_HANDS_ENABLE          case ACT_SWAP_HANDS:              switch (action.swap.code) { @@ -694,7 +698,7 @@ void process_action(keyrecord_t *record, action_t action) {                      /* tap key */                      if (tap_count > 0) {                          if (swap_held) { -                            swap_hands = !swap_hands;  // undo hold set up in _tap_hint +                            swap_hands = !swap_hands; // undo hold set up in _tap_hint                              swap_held  = false;                          }                          if (event.pressed) { @@ -702,22 +706,17 @@ void process_action(keyrecord_t *record, action_t action) {                          } else {                              wait_ms(TAP_CODE_DELAY);                              unregister_code(action.swap.code); -                            *record = (keyrecord_t){};  // hack: reset tap mode +                            *record = (keyrecord_t){}; // hack: reset tap mode                          }                      } else {                          if (swap_held && !event.pressed) { -                            swap_hands = !swap_hands;  // undo hold set up in _tap_hint +                            swap_hands = !swap_hands; // undo hold set up in _tap_hint                              swap_held  = false;                          }                      }  #    endif              }  #endif -#ifndef NO_ACTION_FUNCTION -        case ACT_FUNCTION: -            action_function(record, action.func.id, action.func.opt); -            break; -#endif          default:              break;      } @@ -794,7 +793,7 @@ void process_action(keyrecord_t *record, action_t action) {   *   * FIXME: Needs documentation.   */ -void register_code(uint8_t code) { +__attribute__((weak)) void register_code(uint8_t code) {      if (code == KC_NO) {          return;      } @@ -887,7 +886,7 @@ void register_code(uint8_t code) {   *   * FIXME: Needs documentation.   */ -void unregister_code(uint8_t code) { +__attribute__((weak)) void unregister_code(uint8_t code) {      if (code == KC_NO) {          return;      } @@ -948,7 +947,7 @@ void unregister_code(uint8_t code) {   * \param code The basic keycode to tap.   * \param delay The amount of time in milliseconds to leave the keycode registered, before unregistering it.   */ -void tap_code_delay(uint8_t code, uint16_t delay) { +__attribute__((weak)) void tap_code_delay(uint8_t code, uint16_t delay) {      register_code(code);      for (uint16_t i = delay; i > 0; i--) {          wait_ms(1); @@ -960,13 +959,15 @@ void tap_code_delay(uint8_t code, uint16_t delay) {   *   * \param code The basic keycode to tap. If `code` is `KC_CAPS_LOCK`, the delay will be `TAP_HOLD_CAPS_DELAY`, otherwise `TAP_CODE_DELAY`, if defined.   */ -void tap_code(uint8_t code) { tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); } +__attribute__((weak)) void tap_code(uint8_t code) { +    tap_code_delay(code, code == KC_CAPS_LOCK ? TAP_HOLD_CAPS_DELAY : TAP_CODE_DELAY); +}  /** \brief Adds the given physically pressed modifiers and sends a keyboard report immediately.   *   * \param mods A bitfield of modifiers to register.   */ -void register_mods(uint8_t mods) { +__attribute__((weak)) void register_mods(uint8_t mods) {      if (mods) {          add_mods(mods);          send_keyboard_report(); @@ -977,7 +978,7 @@ void register_mods(uint8_t mods) {   *   * \param mods A bitfield of modifiers to unregister.   */ -void unregister_mods(uint8_t mods) { +__attribute__((weak)) void unregister_mods(uint8_t mods) {      if (mods) {          del_mods(mods);          send_keyboard_report(); @@ -988,7 +989,7 @@ void unregister_mods(uint8_t mods) {   *   * \param mods A bitfield of modifiers to register.   */ -void register_weak_mods(uint8_t mods) { +__attribute__((weak)) void register_weak_mods(uint8_t mods) {      if (mods) {          add_weak_mods(mods);          send_keyboard_report(); @@ -999,7 +1000,7 @@ void register_weak_mods(uint8_t mods) {   *   * \param mods A bitfield of modifiers to unregister.   */ -void unregister_weak_mods(uint8_t mods) { +__attribute__((weak)) void unregister_weak_mods(uint8_t mods) {      if (mods) {          del_weak_mods(mods);          send_keyboard_report(); @@ -1034,7 +1035,6 @@ void clear_keyboard_but_mods_and_keys() {      host_consumer_send(0);  #endif      clear_weak_mods(); -    clear_macro_mods();      send_keyboard_report();  #ifdef MOUSEKEY_ENABLE      mousekey_clear(); @@ -1097,12 +1097,6 @@ bool is_tap_action(action_t action) {                      return true;              }              return false; -        case ACT_MACRO: -        case ACT_FUNCTION: -            if (action.func.opt & FUNC_TAP) { -                return true; -            } -            return false;      }      return false;  } @@ -1111,7 +1105,9 @@ bool is_tap_action(action_t action) {   *   * FIXME: Needs documentation.   */ -void debug_event(keyevent_t event) { dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); } +void debug_event(keyevent_t event) { +    dprintf("%04X%c(%u)", (event.key.row << 8 | event.key.col), (event.pressed ? 'd' : 'u'), event.time); +}  /** \brief Debug print (FIXME: Needs better description)   *   * FIXME: Needs documentation. @@ -1159,12 +1155,6 @@ void debug_action(action_t action) {          case ACT_LAYER_TAP_EXT:              dprint("ACT_LAYER_TAP_EXT");              break; -        case ACT_MACRO: -            dprint("ACT_MACRO"); -            break; -        case ACT_FUNCTION: -            dprint("ACT_FUNCTION"); -            break;          case ACT_SWAP_HANDS:              dprint("ACT_SWAP_HANDS");              break; | 
