]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Add per-event user hook function to QMK
authorDamien Pollet <damien.pollet@gmail.com>
Sun, 27 Mar 2016 15:58:26 +0000 (17:58 +0200)
committerDamien Pollet <damien.pollet@gmail.com>
Mon, 28 Mar 2016 14:30:00 +0000 (16:30 +0200)
tmk_core/common/action.c
tmk_core/common/action.h

index 4197c53ed21609dc2d1838c035b7b8f8fce6c714..c6595196ff4e1b6603614dd02f68f8ead4ed160c 100644 (file)
@@ -53,6 +53,9 @@ void action_exec(keyevent_t event)
 #endif
 }
 
+__attribute__ ((weak))
+void process_action_user(keyrecord_t *record) {}
+
 void process_action(keyrecord_t *record)
 {
     keyevent_t event = record->event;
@@ -62,6 +65,8 @@ void process_action(keyrecord_t *record)
 
     if (IS_NOEVENT(event)) { return; }
 
+    process_action_user(record);
+
     action_t action = layer_switch_get_action(event.key);
     dprint("ACTION: "); debug_action(action);
 #ifndef NO_ACTION_LAYER
index 8a4736d7bc19cbb833481649b467cc4da109e1ac..141dc3fca63634219df71ea4c3b3ae8ad9fc4ad0 100644 (file)
@@ -58,6 +58,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt);
 /* user defined special function */
 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt);
 
+/* user-defined (pre)processing of each key event */
+void process_action_user(keyrecord_t *record);
+
 /* Utilities for actions.  */
 void process_action(keyrecord_t *record);
 void register_code(uint8_t code);