Tidy up use of keycode range helpers (#19813)
parent
13af265268
commit
6ceff1367d
|
@ -13,6 +13,8 @@ def _translate_group(group):
|
||||||
"""
|
"""
|
||||||
if group == 'modifiers':
|
if group == 'modifiers':
|
||||||
return 'modifier'
|
return 'modifier'
|
||||||
|
if group == 'media':
|
||||||
|
return 'consumer'
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ void register_mouse(uint8_t mouse_keycode, bool pressed) {
|
||||||
#elif defined(POINTING_DEVICE_ENABLE)
|
#elif defined(POINTING_DEVICE_ENABLE)
|
||||||
// if mousekeys isn't enabled, and pointing device is enabled, then
|
// if mousekeys isn't enabled, and pointing device is enabled, then
|
||||||
// let pointing device do all the heavy lifting, then
|
// let pointing device do all the heavy lifting, then
|
||||||
if IS_MOUSEKEY (mouse_keycode) {
|
if IS_MOUSE_KEYCODE (mouse_keycode) {
|
||||||
pointing_device_keycode_handler(mouse_keycode, pressed);
|
pointing_device_keycode_handler(mouse_keycode, pressed);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -895,13 +895,13 @@ __attribute__((weak)) void register_code(uint8_t code) {
|
||||||
send_keyboard_report();
|
send_keyboard_report();
|
||||||
|
|
||||||
#ifdef EXTRAKEY_ENABLE
|
#ifdef EXTRAKEY_ENABLE
|
||||||
} else if IS_SYSTEM (code) {
|
} else if IS_SYSTEM_KEYCODE (code) {
|
||||||
host_system_send(KEYCODE2SYSTEM(code));
|
host_system_send(KEYCODE2SYSTEM(code));
|
||||||
} else if IS_CONSUMER (code) {
|
} else if IS_CONSUMER_KEYCODE (code) {
|
||||||
host_consumer_send(KEYCODE2CONSUMER(code));
|
host_consumer_send(KEYCODE2CONSUMER(code));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if IS_MOUSEKEY (code) {
|
} else if IS_MOUSE_KEYCODE (code) {
|
||||||
register_mouse(code, true);
|
register_mouse(code, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -958,7 +958,7 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
|
||||||
host_consumer_send(0);
|
host_consumer_send(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if IS_MOUSEKEY (code) {
|
} else if IS_MOUSE_KEYCODE (code) {
|
||||||
register_mouse(code, false);
|
register_mouse(code, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
|
#define IS_ANY(code) (KC_A <= (code) && (code) <= 0xFF)
|
||||||
|
|
||||||
#define IS_SYSTEM(code) IS_SYSTEM_KEYCODE(code)
|
|
||||||
#define IS_CONSUMER(code) IS_MEDIA_KEYCODE(code)
|
|
||||||
|
|
||||||
#define IS_MOUSEKEY(code) IS_MOUSE_KEYCODE(code)
|
#define IS_MOUSEKEY(code) IS_MOUSE_KEYCODE(code)
|
||||||
#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT)
|
#define IS_MOUSEKEY_MOVE(code) (KC_MS_UP <= (code) && (code) <= KC_MS_RIGHT)
|
||||||
#define IS_MOUSEKEY_BUTTON(code) (KC_MS_BTN1 <= (code) && (code) <= KC_MS_BTN8)
|
#define IS_MOUSEKEY_BUTTON(code) (KC_MS_BTN1 <= (code) && (code) <= KC_MS_BTN8)
|
||||||
|
|
|
@ -1323,7 +1323,7 @@ enum qk_keycode_defines {
|
||||||
#define IS_INTERNAL_KEYCODE(code) ((code) >= KC_NO && (code) <= KC_TRANSPARENT)
|
#define IS_INTERNAL_KEYCODE(code) ((code) >= KC_NO && (code) <= KC_TRANSPARENT)
|
||||||
#define IS_BASIC_KEYCODE(code) ((code) >= KC_A && (code) <= KC_EXSEL)
|
#define IS_BASIC_KEYCODE(code) ((code) >= KC_A && (code) <= KC_EXSEL)
|
||||||
#define IS_SYSTEM_KEYCODE(code) ((code) >= KC_SYSTEM_POWER && (code) <= KC_SYSTEM_WAKE)
|
#define IS_SYSTEM_KEYCODE(code) ((code) >= KC_SYSTEM_POWER && (code) <= KC_SYSTEM_WAKE)
|
||||||
#define IS_MEDIA_KEYCODE(code) ((code) >= KC_AUDIO_MUTE && (code) <= KC_ASSISTANT)
|
#define IS_CONSUMER_KEYCODE(code) ((code) >= KC_AUDIO_MUTE && (code) <= KC_ASSISTANT)
|
||||||
#define IS_MOUSE_KEYCODE(code) ((code) >= KC_MS_UP && (code) <= KC_MS_ACCEL2)
|
#define IS_MOUSE_KEYCODE(code) ((code) >= KC_MS_UP && (code) <= KC_MS_ACCEL2)
|
||||||
#define IS_MODIFIER_KEYCODE(code) ((code) >= KC_LEFT_CTRL && (code) <= KC_RIGHT_GUI)
|
#define IS_MODIFIER_KEYCODE(code) ((code) >= KC_LEFT_CTRL && (code) <= KC_RIGHT_GUI)
|
||||||
#define IS_SWAP_HANDS_KEYCODE(code) ((code) >= QK_SWAP_HANDS_TOGGLE && (code) <= QK_SWAP_HANDS_ONE_SHOT)
|
#define IS_SWAP_HANDS_KEYCODE(code) ((code) >= QK_SWAP_HANDS_TOGGLE && (code) <= QK_SWAP_HANDS_ONE_SHOT)
|
||||||
|
|
Loading…
Reference in New Issue