Minor tidy up of key overrides (#13747)

* Minor tidy up of key overrides

* Update quantum/quantum.c

* Update quantum/quantum.c
This commit is contained in:
Joel Challis 2021-07-28 12:01:49 +01:00 committed by GitHub
parent 50964ae821
commit 4ef8ff458d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 39 deletions

View File

@ -334,11 +334,6 @@ ifeq ($(strip $(PRINTING_ENABLE)), yes)
SRC += $(TMK_DIR)/protocol/serial_uart.c SRC += $(TMK_DIR)/protocol/serial_uart.c
endif endif
ifeq ($(strip $(KEY_OVERRIDE_ENABLE)), yes)
OPT_DEFS += -DKEY_OVERRIDE_ENABLE
SRC += $(QUANTUM_DIR)/process_keycode/process_key_override.c
endif
ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes)
SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c) SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c) SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
@ -663,6 +658,11 @@ ifeq ($(strip $(COMBO_ENABLE)), yes)
OPT_DEFS += -DCOMBO_ENABLE OPT_DEFS += -DCOMBO_ENABLE
endif endif
ifeq ($(strip $(KEY_OVERRIDE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_key_override.c
OPT_DEFS += -DKEY_OVERRIDE_ENABLE
endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
OPT_DEFS += -DTAP_DANCE_ENABLE OPT_DEFS += -DTAP_DANCE_ENABLE

View File

@ -380,7 +380,7 @@ static bool try_activating_override(const uint16_t keycode, const uint8_t layer,
return true; return true;
} }
void matrix_scan_key_override(void) { void key_override_task(void) {
if (deferred_register == 0) { if (deferred_register == 0) {
return; return;
} }

View File

@ -92,16 +92,22 @@ typedef struct {
extern const key_override_t **key_overrides; extern const key_override_t **key_overrides;
/** Turns key overrides on */ /** Turns key overrides on */
extern void key_override_on(void); void key_override_on(void);
/** Turns key overrides off */ /** Turns key overrides off */
extern void key_override_off(void); void key_override_off(void);
/** Toggles key overrides on */ /** Toggles key overrides on */
extern void key_override_toggle(void); void key_override_toggle(void);
/** Returns whether key overrides are enabled */ /** 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. * 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.

View File

@ -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);

View File

@ -55,10 +55,6 @@ float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
# include "process_auto_shift.h" # include "process_auto_shift.h"
#endif #endif
#ifdef KEY_OVERRIDE_ENABLE
# include "process_key_override_private.h"
#endif
uint8_t extract_mod_bits(uint16_t code) { uint8_t extract_mod_bits(uint16_t code) {
switch (code) { switch (code) {
case QK_MODS ... QK_MODS_MAX: case QK_MODS ... QK_MODS_MAX:
@ -415,7 +411,7 @@ void matrix_scan_quantum() {
#endif #endif
#ifdef KEY_OVERRIDE_ENABLE #ifdef KEY_OVERRIDE_ENABLE
matrix_scan_key_override(); key_override_task();
#endif #endif
#ifdef SEQUENCER_ENABLE #ifdef SEQUENCER_ENABLE