Reallocate SAFE_RANGE (#19909)

This commit is contained in:
Joel Challis
2023-02-22 22:49:07 +00:00
committed by GitHub
parent ea77246865
commit 961f0b7b2d
50 changed files with 31 additions and 132 deletions

View File

@@ -304,7 +304,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
}
# endif // !NO_CHARYBDIS_KEYCODES
# endif // POINTING_DEVICE_ENABLE
if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < CHARYBDIS_SAFE_RANGE) || IS_MOUSEKEY(keycode)) {
if (IS_QK_KB(keycode) || IS_MOUSEKEY(keycode)) {
debug_charybdis_config_to_console(&g_charybdis_config);
}
return true;

View File

@@ -43,7 +43,6 @@ enum charybdis_keycodes {
SNIPING_MODE_TOGGLE,
DRAGSCROLL_MODE,
DRAGSCROLL_MODE_TOGGLE,
CHARYBDIS_SAFE_RANGE,
};
# define DPI_MOD POINTER_DEFAULT_DPI_FORWARD

View File

@@ -121,7 +121,7 @@ The Charybdis firmware defines a number of keycodes to leverage its features, na
```
#ifndef NO_CHARYBDIS_KEYCODES
enum charybdis_keycodes {
POINTER_DEFAULT_DPI_FORWARD = SAFE_RANGE,
POINTER_DEFAULT_DPI_FORWARD = QK_KB_0,
POINTER_DEFAULT_DPI_REVERSE,
POINTER_SNIPING_DPI_FORWARD,
POINTER_SNIPING_DPI_REVERSE,
@@ -129,7 +129,6 @@ enum charybdis_keycodes {
SNIPING_MODE_TOGGLE,
DRAGSCROLL_MODE,
DRAGSCROLL_MODE_TOGGLE,
CHARYBDIS_SAFE_RANGE,
};
#define DPI_MOD POINTER_DEFAULT_DPI_FORWARD
@@ -143,20 +142,6 @@ enum charybdis_keycodes {
#endif // !NO_CHARYBDIS_KEYCODES
```
Users extending the keycode set themselves (either in their keymap, or in their userspace) must start at `CHARYBDIS_SAFE_RANGE` to avoid conflicts, _eg._:
```c
enum userspace_keycodes {
#ifndef NO_CHARYBDIS_KEYCODES
MY_FIRST_KEYCODE = CHARYBDIS_SAFE_RANGE,
#else
MY_FIRST_KEYCODE = SAFE_RANGE,
#endif // !NO_CHARYBDIS_KEYCODES
MY_SECOND_KEYCODE,
};
```
To disable the custom keycodes, and reduce binary size, simply add a definition in `config.h`:
```c

View File

@@ -308,7 +308,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
# endif // !NO_DILEMMA_KEYCODES
# endif // POINTING_DEVICE_ENABLE
debug_dilemma_config_to_console(&g_dilemma_config);
if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < DILEMMA_SAFE_RANGE) || IS_MOUSEKEY(keycode)) {
if (IS_QK_KB(keycode) || IS_MOUSEKEY(keycode)) {
debug_dilemma_config_to_console(&g_dilemma_config);
}
return true;

View File

@@ -40,7 +40,6 @@ enum dilemma_keycodes {
SNIPING_MODE_TOGGLE,
DRAGSCROLL_MODE,
DRAGSCROLL_MODE_TOGGLE,
DILEMMA_SAFE_RANGE,
};
# define DPI_MOD POINTER_DEFAULT_DPI_FORWARD