summaryrefslogtreecommitdiff
path: root/quantum/process_keycode
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2022-12-14 13:46:01 +1100
committerGitHub <noreply@github.com>2022-12-14 13:46:01 +1100
commite2117564c54044c809903627c0061b5a9d129815 (patch)
tree6439e66eac4c362e16aaa65b1f4530598b91828d /quantum/process_keycode
parent49b81a9c2b9dca681cf26ced9c1115c2c53f1ba1 (diff)
Leader: remove `qk_` prefix (#19304)
Diffstat (limited to 'quantum/process_keycode')
-rw-r--r--quantum/process_keycode/process_leader.c42
-rw-r--r--quantum/process_keycode/process_leader.h4
2 files changed, 24 insertions, 22 deletions
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index b74b4927a8..80bc96e65f 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -14,18 +14,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef LEADER_ENABLE
+#include "process_leader.h"
+#include <string.h>
-# include "process_leader.h"
-# include <string.h>
-
-# ifndef LEADER_TIMEOUT
-# define LEADER_TIMEOUT 300
-# endif
+#ifndef LEADER_TIMEOUT
+# define LEADER_TIMEOUT 300
+#endif
-__attribute__((weak)) void leader_start(void) {}
+__attribute__((weak)) void leader_start_user(void) {}
-__attribute__((weak)) void leader_end(void) {}
+__attribute__((weak)) void leader_end_user(void) {}
// Leader key stuff
bool leading = false;
@@ -34,52 +32,54 @@ uint16_t leader_time = 0;
uint16_t leader_sequence[5] = {0, 0, 0, 0, 0};
uint8_t leader_sequence_size = 0;
-void qk_leader_start(void) {
+void leader_start(void) {
if (leading) {
return;
}
- leader_start();
+ leader_start_user();
leading = true;
leader_time = timer_read();
leader_sequence_size = 0;
memset(leader_sequence, 0, sizeof(leader_sequence));
}
+void leader_end(void) {
+ leader_end_user();
+}
+
bool process_leader(uint16_t keycode, keyrecord_t *record) {
// Leader key set-up
if (record->event.pressed) {
if (leading) {
-# ifndef LEADER_NO_TIMEOUT
+#ifndef LEADER_NO_TIMEOUT
if (timer_elapsed(leader_time) < LEADER_TIMEOUT)
-# endif // LEADER_NO_TIMEOUT
+#endif // LEADER_NO_TIMEOUT
{
-# ifndef LEADER_KEY_STRICT_KEY_PROCESSING
+#ifndef LEADER_KEY_STRICT_KEY_PROCESSING
if (IS_QK_MOD_TAP(keycode)) {
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
} else if (IS_QK_LAYER_TAP(keycode)) {
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
}
-# endif // LEADER_KEY_STRICT_KEY_PROCESSING
+#endif // LEADER_KEY_STRICT_KEY_PROCESSING
if (leader_sequence_size < ARRAY_SIZE(leader_sequence)) {
leader_sequence[leader_sequence_size] = keycode;
leader_sequence_size++;
} else {
leading = false;
- leader_end();
+ leader_end_user();
return true;
}
-# ifdef LEADER_PER_KEY_TIMING
+#ifdef LEADER_PER_KEY_TIMING
leader_time = timer_read();
-# endif
+#endif
return false;
}
} else {
if (keycode == QK_LEADER) {
- qk_leader_start();
+ leader_start();
}
}
}
return true;
}
-
-#endif
diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h
index f3fe14a432..82b4a3ed7b 100644
--- a/quantum/process_keycode/process_leader.h
+++ b/quantum/process_keycode/process_leader.h
@@ -20,9 +20,11 @@
bool process_leader(uint16_t keycode, keyrecord_t *record);
+void leader_start_user(void);
+void leader_end_user(void);
+
void leader_start(void);
void leader_end(void);
-void qk_leader_start(void);
#define SEQ_ONE_KEY(key) if (leader_sequence[0] == (key) && leader_sequence[1] == 0 && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)
#define SEQ_TWO_KEYS(key1, key2) if (leader_sequence[0] == (key1) && leader_sequence[1] == (key2) && leader_sequence[2] == 0 && leader_sequence[3] == 0 && leader_sequence[4] == 0)