diff options
author | Drashna Jaelre <drashna@live.com> | 2022-09-26 20:49:32 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-26 20:49:32 -0700 |
commit | fb400f2ac2c57fa0fc82ca803f6450b818bb32f9 (patch) | |
tree | 0f9939fc9404fc2104c0c664c6a2ea0c90276558 /quantum | |
parent | d909038b28c553f5eb0ecec74f58792155c4d49d (diff) |
Enabling Pointing Device support in register code functions (#18363)
Diffstat (limited to 'quantum')
-rw-r--r-- | quantum/action.c | 8 | ||||
-rw-r--r-- | quantum/pointing_device/pointing_device.c | 8 | ||||
-rw-r--r-- | quantum/pointing_device/pointing_device.h | 1 |
3 files changed, 17 insertions, 0 deletions
diff --git a/quantum/action.c b/quantum/action.c index a1476131b9..4f01acb96e 100644 --- a/quantum/action.c +++ b/quantum/action.c @@ -918,6 +918,10 @@ __attribute__((weak)) void register_code(uint8_t code) { mousekey_on(code); mousekey_send(); } +#elif defined(POINTING_DEVICE_ENABLE) + else if IS_MOUSEKEY (code) { + pointing_device_keycode_handler(code, true); + } #endif } @@ -978,6 +982,10 @@ __attribute__((weak)) void unregister_code(uint8_t code) { mousekey_off(code); mousekey_send(); } +#elif defined(POINTING_DEVICE_ENABLE) + else if IS_MOUSEKEY (code) { + pointing_device_keycode_handler(code, false); + } #endif } diff --git a/quantum/pointing_device/pointing_device.c b/quantum/pointing_device/pointing_device.c index 6981f850d0..75bb5f81fc 100644 --- a/quantum/pointing_device/pointing_device.c +++ b/quantum/pointing_device/pointing_device.c @@ -22,6 +22,7 @@ #ifdef MOUSEKEY_ENABLE # include "mousekey.h" #endif + #if (defined(POINTING_DEVICE_ROTATION_90) + defined(POINTING_DEVICE_ROTATION_180) + defined(POINTING_DEVICE_ROTATION_270)) > 1 # error More than one rotation selected. This is not supported. #endif @@ -479,3 +480,10 @@ __attribute__((weak)) report_mouse_t pointing_device_task_combined_user(report_m return pointing_device_combine_reports(left_report, right_report); } #endif + +__attribute__((weak)) void pointing_device_keycode_handler(uint16_t keycode, bool pressed) { + if IS_MOUSEKEY_BUTTON (keycode) { + local_mouse_report.buttons = pointing_device_handle_buttons(local_mouse_report.buttons, pressed, keycode - KC_MS_BTN1); + pointing_device_send(); + } +} diff --git a/quantum/pointing_device/pointing_device.h b/quantum/pointing_device/pointing_device.h index 27a3f95e32..d430e6cfa4 100644 --- a/quantum/pointing_device/pointing_device.h +++ b/quantum/pointing_device/pointing_device.h @@ -110,6 +110,7 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report); report_mouse_t pointing_device_task_user(report_mouse_t mouse_report); uint8_t pointing_device_handle_buttons(uint8_t buttons, bool pressed, pointing_device_buttons_t button); report_mouse_t pointing_device_adjust_by_defines(report_mouse_t mouse_report); +void pointing_device_keycode_handler(uint16_t keycode, bool pressed); #if defined(SPLIT_POINTING_ENABLE) void pointing_device_set_shared_report(report_mouse_t report); |