diff options
author | Jack Humbert <jack.humb@gmail.com> | 2016-05-15 00:47:25 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2016-05-15 00:47:25 -0400 |
commit | bf5c2ccee5497523c214dae7aacdc27fdbb0f235 (patch) | |
tree | 0bd27929ab759c0b7fd454e9a684bb1618330af6 /tmk_core/common/action.c | |
parent | 15719f3574c6274ee0f3ec87431927c5a523aa3e (diff) |
splits process_action up to handle records separately (#329)
* implements leader key for planck experimental
* allows override of leader timeout
* adds ability to use the leader key in seq
* fixes leader keycode
* adds chording prototype
* fixes keycode detection
* moves music mode to quantum.c
* disables chording by default
* adds music sequencer functionality
* implements audio/music functions in quantum.c
* splits up process_action to allow independent processing of actions
* merging?
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r-- | tmk_core/common/action.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c index c026b96d9c..be6dea2b79 100644 --- a/tmk_core/common/action.c +++ b/tmk_core/common/action.c @@ -46,7 +46,7 @@ void action_exec(keyevent_t event) #ifndef NO_ACTION_TAPPING action_tapping_process(record); #else - process_action(&record); + process_record(&record); if (!IS_NOEVENT(record.event)) { dprint("processed: "); debug_record(record); dprintln(); } @@ -56,25 +56,43 @@ void action_exec(keyevent_t event) #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) bool disable_action_cache = false; -void process_action_nocache(keyrecord_t *record) +void process_record_nocache(keyrecord_t *record) { disable_action_cache = true; - process_action(record); + process_record(record); disable_action_cache = false; } #else -void process_action_nocache(keyrecord_t *record) +void process_record_nocache(keyrecord_t *record) { - process_action(record); + process_record(record); } #endif __attribute__ ((weak)) -bool process_action_quantum(keyrecord_t *record) { +bool process_record_quantum(keyrecord_t *record) { return true; } -void process_action(keyrecord_t *record) +void process_record(keyrecord_t *record) +{ + if (IS_NOEVENT(record->event)) { return; } + + if(!process_record_quantum(record)) + return; + + action_t action = store_or_get_action(record->event.pressed, record->event.key); + dprint("ACTION: "); debug_action(action); +#ifndef NO_ACTION_LAYER + dprint(" layer_state: "); layer_debug(); + dprint(" default_layer_state: "); default_layer_debug(); +#endif + dprintln(); + + process_action(record, action); +} + +void process_action(keyrecord_t *record, action_t action) { bool do_release_oneshot = false; keyevent_t event = record->event; @@ -82,8 +100,6 @@ void process_action(keyrecord_t *record) uint8_t tap_count = record->tap.count; #endif - if (IS_NOEVENT(event)) { return; } - #if (defined(ONESHOT_TIMEOUT) && (ONESHOT_TIMEOUT > 0)) if (has_oneshot_layer_timed_out()) { dprintf("Oneshot layer: timeout\n"); @@ -91,17 +107,6 @@ void process_action(keyrecord_t *record) } #endif - if (!process_action_quantum(record)) - return; - - action_t action = store_or_get_action(event.pressed, event.key); - dprint("ACTION: "); debug_action(action); -#ifndef NO_ACTION_LAYER - dprint(" layer_state: "); layer_debug(); - dprint(" default_layer_state: "); default_layer_debug(); -#endif - dprintln(); - if (event.pressed) { // clear the potential weak mods left by previously pressed keys clear_weak_mods(); @@ -451,7 +456,7 @@ void process_action(keyrecord_t *record) if (do_release_oneshot && !(get_oneshot_layer_state() & ONESHOT_PRESSED ) ) { record->event.pressed = false; layer_on(get_oneshot_layer()); - process_action(record); + process_record(record); layer_off(get_oneshot_layer()); } #endif |