Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor tidy up of key overrides #13747

Merged
merged 3 commits into from
Jul 28, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions common_features.mk
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,6 @@ ifeq ($(strip $(PRINTING_ENABLE)), yes)
SRC += $(TMK_DIR)/protocol/serial_uart.c
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)
SERIAL_SRC := $(wildcard $(SERIAL_PATH)/protocol/*.c)
SERIAL_SRC += $(wildcard $(SERIAL_PATH)/system/*.c)
Expand Down Expand Up @@ -668,6 +663,11 @@ ifeq ($(strip $(COMBO_ENABLE)), yes)
OPT_DEFS += -DCOMBO_ENABLE
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)
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
OPT_DEFS += -DTAP_DANCE_ENABLE
Expand Down
2 changes: 1 addition & 1 deletion quantum/process_keycode/process_key_override.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 10 additions & 4 deletions quantum/process_keycode/process_key_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
24 changes: 0 additions & 24 deletions quantum/process_keycode/process_key_override_private.h

This file was deleted.

7 changes: 1 addition & 6 deletions quantum/quantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ float default_layer_songs[][16][2] = DEFAULT_LAYER_SONGS;
#ifdef AUTO_SHIFT_ENABLE
# include "process_auto_shift.h"
zvecr marked this conversation as resolved.
Show resolved Hide resolved
#endif
zvecr marked this conversation as resolved.
Show resolved Hide resolved

#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:
Expand Down Expand Up @@ -415,7 +410,7 @@ void matrix_scan_quantum() {
#endif

#ifdef KEY_OVERRIDE_ENABLE
matrix_scan_key_override();
key_override_task();
#endif

#ifdef SEQUENCER_ENABLE
Expand Down