Reallocate user/kb keycode ranges (#19907)

This commit is contained in:
Joel Challis 2023-02-22 22:50:09 +00:00 committed by GitHub
parent 961f0b7b2d
commit 9f2cd9119f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 69 deletions

View File

@ -1,5 +1,14 @@
{ {
"ranges": { "ranges": {
"0x7E00/0x00FF": "!delete!",
"0x7F00/0x00FF": "!delete!",
"0x7E00/0x003F": {
"define": "QK_KB"
},
"0x7E40/0x01BF": {
"define": "QK_USER"
},
"0x8000/0X3FFF": { "0x8000/0X3FFF": {
"define": "QK_UNICODEMAP" "define": "QK_UNICODEMAP"
}, },

View File

@ -1,130 +1,130 @@
{ {
"keycodes": { "keycodes": {
"0x7F00": { "0x7E40": {
"group": "user", "group": "user",
"key": "QK_USER_0", "key": "QK_USER_0",
}, },
"0x7F01": { "0x7E41": {
"group": "user", "group": "user",
"key": "QK_USER_1", "key": "QK_USER_1",
}, },
"0x7F02": { "0x7E42": {
"group": "user", "group": "user",
"key": "QK_USER_2", "key": "QK_USER_2",
}, },
"0x7F03": { "0x7E43": {
"group": "user", "group": "user",
"key": "QK_USER_3", "key": "QK_USER_3",
}, },
"0x7F04": { "0x7E44": {
"group": "user", "group": "user",
"key": "QK_USER_4", "key": "QK_USER_4",
}, },
"0x7F05": { "0x7E45": {
"group": "user", "group": "user",
"key": "QK_USER_5", "key": "QK_USER_5",
}, },
"0x7F06": { "0x7E46": {
"group": "user", "group": "user",
"key": "QK_USER_6", "key": "QK_USER_6",
}, },
"0x7F07": { "0x7E47": {
"group": "user", "group": "user",
"key": "QK_USER_7", "key": "QK_USER_7",
}, },
"0x7F08": { "0x7E48": {
"group": "user", "group": "user",
"key": "QK_USER_8", "key": "QK_USER_8",
}, },
"0x7F09": { "0x7E49": {
"group": "user", "group": "user",
"key": "QK_USER_9", "key": "QK_USER_9",
}, },
"0x7F0A": { "0x7E4A": {
"group": "user", "group": "user",
"key": "QK_USER_10", "key": "QK_USER_10",
}, },
"0x7F0B": { "0x7E4B": {
"group": "user", "group": "user",
"key": "QK_USER_11", "key": "QK_USER_11",
}, },
"0x7F0C": { "0x7E4C": {
"group": "user", "group": "user",
"key": "QK_USER_12", "key": "QK_USER_12",
}, },
"0x7F0D": { "0x7E4D": {
"group": "user", "group": "user",
"key": "QK_USER_13", "key": "QK_USER_13",
}, },
"0x7F0E": { "0x7E4E": {
"group": "user", "group": "user",
"key": "QK_USER_14", "key": "QK_USER_14",
}, },
"0x7F0F": { "0x7E4F": {
"group": "user", "group": "user",
"key": "QK_USER_15", "key": "QK_USER_15",
}, },
"0x7F10": { "0x7E50": {
"group": "user", "group": "user",
"key": "QK_USER_16", "key": "QK_USER_16",
}, },
"0x7F11": { "0x7E51": {
"group": "user", "group": "user",
"key": "QK_USER_17", "key": "QK_USER_17",
}, },
"0x7F12": { "0x7E52": {
"group": "user", "group": "user",
"key": "QK_USER_18", "key": "QK_USER_18",
}, },
"0x7F13": { "0x7E53": {
"group": "user", "group": "user",
"key": "QK_USER_19", "key": "QK_USER_19",
}, },
"0x7F14": { "0x7E54": {
"group": "user", "group": "user",
"key": "QK_USER_20", "key": "QK_USER_20",
}, },
"0x7F15": { "0x7E55": {
"group": "user", "group": "user",
"key": "QK_USER_21", "key": "QK_USER_21",
}, },
"0x7F16": { "0x7E56": {
"group": "user", "group": "user",
"key": "QK_USER_22", "key": "QK_USER_22",
}, },
"0x7F17": { "0x7E57": {
"group": "user", "group": "user",
"key": "QK_USER_23", "key": "QK_USER_23",
}, },
"0x7F18": { "0x7E58": {
"group": "user", "group": "user",
"key": "QK_USER_24", "key": "QK_USER_24",
}, },
"0x7F19": { "0x7E59": {
"group": "user", "group": "user",
"key": "QK_USER_25", "key": "QK_USER_25",
}, },
"0x7F1A": { "0x7E5A": {
"group": "user", "group": "user",
"key": "QK_USER_26", "key": "QK_USER_26",
}, },
"0x7F1B": { "0x7E5B": {
"group": "user", "group": "user",
"key": "QK_USER_27", "key": "QK_USER_27",
}, },
"0x7F1C": { "0x7E5C": {
"group": "user", "group": "user",
"key": "QK_USER_28", "key": "QK_USER_28",
}, },
"0x7F1D": { "0x7E5D": {
"group": "user", "group": "user",
"key": "QK_USER_29", "key": "QK_USER_29",
}, },
"0x7F1E": { "0x7E5E": {
"group": "user", "group": "user",
"key": "QK_USER_30", "key": "QK_USER_30",
}, },
"0x7F1F": { "0x7E5F": {
"group": "user", "group": "user",
"key": "QK_USER_31", "key": "QK_USER_31",
}, },

View File

@ -107,6 +107,7 @@ def deep_update(origdict, newdict):
def merge_ordered_dicts(dicts): def merge_ordered_dicts(dicts):
"""Merges nested OrderedDict objects resulting from reading a hjson file. """Merges nested OrderedDict objects resulting from reading a hjson file.
Later input dicts overrides earlier dicts for plain values. Later input dicts overrides earlier dicts for plain values.
If any value is "!delete!", the existing value will be removed from its parent.
Arrays will be appended. If the first entry of an array is "!reset!", the contents of the array will be cleared and replaced with RHS. Arrays will be appended. If the first entry of an array is "!reset!", the contents of the array will be cleared and replaced with RHS.
Dictionaries will be recursively merged. If any entry is "!reset!", the contents of the dictionary will be cleared and replaced with RHS. Dictionaries will be recursively merged. If any entry is "!reset!", the contents of the dictionary will be cleared and replaced with RHS.
""" """
@ -125,6 +126,8 @@ def merge_ordered_dicts(dicts):
target[k] = v[1:] target[k] = v[1:]
else: else:
target[k] = target[k] + v target[k] = target[k] + v
elif v == "!delete!" and isinstance(target, (OrderedDict, dict)):
del target[k]
else: else:
target[k] = v target[k] = v

View File

@ -90,6 +90,7 @@ def load_spec(version, lang=None):
# Sort? # Sort?
spec['keycodes'] = dict(sorted(spec.get('keycodes', {}).items())) spec['keycodes'] = dict(sorted(spec.get('keycodes', {}).items()))
spec['ranges'] = dict(sorted(spec.get('ranges', {}).items()))
# Validate? # Validate?
_validate(spec) _validate(spec)

View File

@ -77,13 +77,13 @@ enum qk_keycode_ranges {
QK_QUANTUM = 0x7C00, QK_QUANTUM = 0x7C00,
QK_QUANTUM_MAX = 0x7DFF, QK_QUANTUM_MAX = 0x7DFF,
QK_KB = 0x7E00, QK_KB = 0x7E00,
QK_KB_MAX = 0x7EFF, QK_KB_MAX = 0x7E3F,
QK_USER = 0x7F00, QK_USER = 0x7E40,
QK_USER_MAX = 0x7FFF, QK_USER_MAX = 0x7FFF,
QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF,
QK_UNICODEMAP = 0x8000, QK_UNICODEMAP = 0x8000,
QK_UNICODEMAP_MAX = 0xBFFF, QK_UNICODEMAP_MAX = 0xBFFF,
QK_UNICODE = 0x8000,
QK_UNICODE_MAX = 0xFFFF,
QK_UNICODEMAP_PAIR = 0xC000, QK_UNICODEMAP_PAIR = 0xC000,
QK_UNICODEMAP_PAIR_MAX = 0xFFFF, QK_UNICODEMAP_PAIR_MAX = 0xFFFF,
}; };
@ -753,38 +753,38 @@ enum qk_keycode_defines {
QK_KB_29 = 0x7E1D, QK_KB_29 = 0x7E1D,
QK_KB_30 = 0x7E1E, QK_KB_30 = 0x7E1E,
QK_KB_31 = 0x7E1F, QK_KB_31 = 0x7E1F,
QK_USER_0 = 0x7F00, QK_USER_0 = 0x7E40,
QK_USER_1 = 0x7F01, QK_USER_1 = 0x7E41,
QK_USER_2 = 0x7F02, QK_USER_2 = 0x7E42,
QK_USER_3 = 0x7F03, QK_USER_3 = 0x7E43,
QK_USER_4 = 0x7F04, QK_USER_4 = 0x7E44,
QK_USER_5 = 0x7F05, QK_USER_5 = 0x7E45,
QK_USER_6 = 0x7F06, QK_USER_6 = 0x7E46,
QK_USER_7 = 0x7F07, QK_USER_7 = 0x7E47,
QK_USER_8 = 0x7F08, QK_USER_8 = 0x7E48,
QK_USER_9 = 0x7F09, QK_USER_9 = 0x7E49,
QK_USER_10 = 0x7F0A, QK_USER_10 = 0x7E4A,
QK_USER_11 = 0x7F0B, QK_USER_11 = 0x7E4B,
QK_USER_12 = 0x7F0C, QK_USER_12 = 0x7E4C,
QK_USER_13 = 0x7F0D, QK_USER_13 = 0x7E4D,
QK_USER_14 = 0x7F0E, QK_USER_14 = 0x7E4E,
QK_USER_15 = 0x7F0F, QK_USER_15 = 0x7E4F,
QK_USER_16 = 0x7F10, QK_USER_16 = 0x7E50,
QK_USER_17 = 0x7F11, QK_USER_17 = 0x7E51,
QK_USER_18 = 0x7F12, QK_USER_18 = 0x7E52,
QK_USER_19 = 0x7F13, QK_USER_19 = 0x7E53,
QK_USER_20 = 0x7F14, QK_USER_20 = 0x7E54,
QK_USER_21 = 0x7F15, QK_USER_21 = 0x7E55,
QK_USER_22 = 0x7F16, QK_USER_22 = 0x7E56,
QK_USER_23 = 0x7F17, QK_USER_23 = 0x7E57,
QK_USER_24 = 0x7F18, QK_USER_24 = 0x7E58,
QK_USER_25 = 0x7F19, QK_USER_25 = 0x7E59,
QK_USER_26 = 0x7F1A, QK_USER_26 = 0x7E5A,
QK_USER_27 = 0x7F1B, QK_USER_27 = 0x7E5B,
QK_USER_28 = 0x7F1C, QK_USER_28 = 0x7E5C,
QK_USER_29 = 0x7F1D, QK_USER_29 = 0x7E5D,
QK_USER_30 = 0x7F1E, QK_USER_30 = 0x7E5E,
QK_USER_31 = 0x7F1F, QK_USER_31 = 0x7E5F,
// Alias // Alias
XXXXXXX = KC_NO, XXXXXXX = KC_NO,
@ -1391,8 +1391,8 @@ enum qk_keycode_defines {
#define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX) #define IS_QK_QUANTUM(code) ((code) >= QK_QUANTUM && (code) <= QK_QUANTUM_MAX)
#define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX) #define IS_QK_KB(code) ((code) >= QK_KB && (code) <= QK_KB_MAX)
#define IS_QK_USER(code) ((code) >= QK_USER && (code) <= QK_USER_MAX) #define IS_QK_USER(code) ((code) >= QK_USER && (code) <= QK_USER_MAX)
#define IS_QK_UNICODE(code) ((code) >= QK_UNICODE && (code) <= QK_UNICODE_MAX)
#define IS_QK_UNICODEMAP(code) ((code) >= QK_UNICODEMAP && (code) <= QK_UNICODEMAP_MAX) #define IS_QK_UNICODEMAP(code) ((code) >= QK_UNICODEMAP && (code) <= QK_UNICODEMAP_MAX)
#define IS_QK_UNICODE(code) ((code) >= QK_UNICODE && (code) <= QK_UNICODE_MAX)
#define IS_QK_UNICODEMAP_PAIR(code) ((code) >= QK_UNICODEMAP_PAIR && (code) <= QK_UNICODEMAP_PAIR_MAX) #define IS_QK_UNICODEMAP_PAIR(code) ((code) >= QK_UNICODEMAP_PAIR && (code) <= QK_UNICODEMAP_PAIR_MAX)
// Group Helpers // Group Helpers