summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-07-28 12:01:49 +0100
committerGitHub <noreply@github.com>2021-07-28 12:01:49 +0100
commit4ef8ff458d7dcf49a288bb484323ab2098a21ef9 (patch)
treee0b8e423300a2375ce0f66f301c57d25e01e6c02 /quantum
parent50964ae82160921f2c442e18c1ffc15316c29815 (diff)
downloadqmk_firmware-4ef8ff458d7dcf49a288bb484323ab2098a21ef9.tar.gz
qmk_firmware-4ef8ff458d7dcf49a288bb484323ab2098a21ef9.zip
Minor tidy up of key overrides (#13747)
* Minor tidy up of key overrides * Update quantum/quantum.c * Update quantum/quantum.c
Diffstat (limited to 'quantum')
-rw-r--r--quantum/process_keycode/process_key_override.c2
-rw-r--r--quantum/process_keycode/process_key_override.h14
-rw-r--r--quantum/process_keycode/process_key_override_private.h24
-rw-r--r--quantum/quantum.c6
4 files changed, 12 insertions, 34 deletions
diff --git a/quantum/process_keycode/process_key_override.c b/quantum/process_keycode/process_key_override.c
index fe43eacc40..8b45a94043 100644
--- a/quantum/process_keycode/process_key_override.c
+++ b/quantum/process_keycode/process_key_override.c
@@ -380,7 +380,7 @@ static bool try_activating_override(const uint16_t keycode, const uint8_t layer,
return true;
}
-void matrix_scan_key_override(void) {
+void key_override_task(void) {
if (deferred_register == 0) {
return;
}
diff --git a/quantum/process_keycode/process_key_override.h b/quantum/process_keycode/process_key_override.h
index 9ba59e4e9b..fd76f297a8 100644
--- a/quantum/process_keycode/process_key_override.h
+++ b/quantum/process_keycode/process_key_override.h
@@ -92,16 +92,22 @@ typedef struct {
extern const key_override_t **key_overrides;
/** Turns key overrides on */
-extern void key_override_on(void);
+void key_override_on(void);
/** Turns key overrides off */
-extern void key_override_off(void);
+void key_override_off(void);
/** Toggles key overrides on */
-extern void key_override_toggle(void);
+void key_override_toggle(void);
/** Returns whether key overrides are enabled */
-extern bool key_override_is_enabled(void);
+bool key_override_is_enabled(void);
+
+/** Handling of key overrides and its implemented keycodes */
+bool process_key_override(const uint16_t keycode, const keyrecord_t *const record);
+
+/** Perform any deferred keys */
+void key_override_task(void);
/**
* Preferrably use these macros to create key overrides. They fix many of the options to a standard setting that should satisfy most basic use-cases. Only directly create a key_override_t struct when you really need to.
diff --git a/quantum/process_keycode/process_key_override_private.h b/quantum/process_keycode/process_key_override_private.h
deleted file mode 100644
index 1d0e134a19..0000000000
--- a/quantum/process_keycode/process_key_override_private.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2021 Jonas Gessner
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#pragma once
-
-#include <stdint.h>
-#include "action.h"
-
-bool process_key_override(const uint16_t keycode, const keyrecord_t *const record);
-void matrix_scan_key_override(void);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 87b219428d..f35939216c 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -55,10 +55,6 @@ float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
# include "process_auto_shift.h"
#endif
-#ifdef KEY_OVERRIDE_ENABLE
-# include "process_key_override_private.h"
-#endif
-
uint8_t extract_mod_bits(uint16_t code) {
switch (code) {
case QK_MODS ... QK_MODS_MAX:
@@ -415,7 +411,7 @@ void matrix_scan_quantum() {
#endif
#ifdef KEY_OVERRIDE_ENABLE
- matrix_scan_key_override();
+ key_override_task();
#endif
#ifdef SEQUENCER_ENABLE