summaryrefslogtreecommitdiff
path: root/tmk_core/common/action.c
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/action.c')
-rw-r--r--tmk_core/common/action.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/tmk_core/common/action.c b/tmk_core/common/action.c
index bd41d28b66..d19fd2a045 100644
--- a/tmk_core/common/action.c
+++ b/tmk_core/common/action.c
@@ -55,6 +55,8 @@ __attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrec
__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; }
+
#ifndef TAP_CODE_DELAY
# define TAP_CODE_DELAY 0
#endif
@@ -106,9 +108,13 @@ void action_exec(keyevent_t event) {
#endif
#ifndef NO_ACTION_TAPPING
- action_tapping_process(record);
+ if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) {
+ action_tapping_process(record);
+ }
#else
- process_record(&record);
+ if (IS_NOEVENT(record.event) || pre_process_record_quantum(&record)) {
+ process_record(&record);
+ }
if (!IS_NOEVENT(record.event)) {
dprint("processed: ");
debug_record(record);
@@ -206,7 +212,16 @@ void process_record(keyrecord_t *record) {
}
void process_record_handler(keyrecord_t *record) {
+#ifdef COMBO_ENABLE
+ action_t action;
+ if (record->keycode) {
+ action = action_for_keycode(record->keycode);
+ } else {
+ action = store_or_get_action(record->event.pressed, record->event.key);
+ }
+#else
action_t action = store_or_get_action(record->event.pressed, record->event.key);
+#endif
dprint("ACTION: ");
debug_action(action);
#ifndef NO_ACTION_LAYER
@@ -994,6 +1009,24 @@ bool is_tap_key(keypos_t key) {
*
* FIXME: Needs documentation.
*/
+bool is_tap_record(keyrecord_t *record) {
+#ifdef COMBO_ENABLE
+ action_t action;
+ if (record->keycode) {
+ action = action_for_keycode(record->keycode);
+ } else {
+ action = layer_switch_get_action(record->event.key);
+ }
+#else
+ action_t action = layer_switch_get_action(record->event.key);
+#endif
+ 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: