Enabling Pointing Device support in register code functions (#18363)
This commit is contained in:
parent
d909038b28
commit
fb400f2ac2
8 changed files with 17 additions and 57 deletions
|
@ -303,16 +303,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
# endif // !NO_CHARYBDIS_KEYCODES
|
# endif // !NO_CHARYBDIS_KEYCODES
|
||||||
# ifndef MOUSEKEY_ENABLE
|
|
||||||
// Simulate mouse keys if full support is not enabled (reduces firmware size
|
|
||||||
// while maintaining support for mouse keys).
|
|
||||||
if (IS_MOUSEKEY_BUTTON(keycode)) {
|
|
||||||
report_mouse_t mouse_report = pointing_device_get_report();
|
|
||||||
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
|
||||||
pointing_device_set_report(mouse_report);
|
|
||||||
pointing_device_send();
|
|
||||||
}
|
|
||||||
# endif // !MOUSEKEY_ENABLE
|
|
||||||
# endif // POINTING_DEVICE_ENABLE
|
# endif // POINTING_DEVICE_ENABLE
|
||||||
if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < CHARYBDIS_SAFE_RANGE) || IS_MOUSEKEY(keycode)) {
|
if ((keycode >= POINTER_DEFAULT_DPI_FORWARD && keycode < CHARYBDIS_SAFE_RANGE) || IS_MOUSEKEY(keycode)) {
|
||||||
debug_charybdis_config_to_console(&g_charybdis_config);
|
debug_charybdis_config_to_console(&g_charybdis_config);
|
||||||
|
|
|
@ -308,16 +308,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
# endif // !NO_CHARYBDIS_KEYCODES
|
# endif // !NO_CHARYBDIS_KEYCODES
|
||||||
# ifndef MOUSEKEY_ENABLE
|
|
||||||
// Simulate mouse keys if full support is not enabled (reduces firmware size
|
|
||||||
// while maintaining support for mouse keys).
|
|
||||||
if (IS_MOUSEKEY_BUTTON(keycode)) {
|
|
||||||
report_mouse_t mouse_report = pointing_device_get_report();
|
|
||||||
mouse_report.buttons = pointing_device_handle_buttons(mouse_report.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
|
||||||
pointing_device_set_report(mouse_report);
|
|
||||||
pointing_device_send();
|
|
||||||
}
|
|
||||||
# endif // !MOUSEKEY_ENABLE
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -167,21 +167,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If Mousekeys is disabled, then use handle the mouse button
|
|
||||||
* keycodes. This makes things simpler, and allows usage of
|
|
||||||
* the keycodes in a consistent manner. But only do this if
|
|
||||||
* Mousekeys is not enable, so it's not handled twice.
|
|
||||||
*/
|
|
||||||
#ifndef MOUSEKEY_ENABLE
|
|
||||||
if (IS_MOUSEKEY_BUTTON(keycode)) {
|
|
||||||
report_mouse_t currentReport = pointing_device_get_report();
|
|
||||||
currentReport.buttons = pointing_device_handle_buttons(currentReport.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
|
||||||
pointing_device_set_report(currentReport);
|
|
||||||
pointing_device_send();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,14 +178,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||||
* the keycodes in a consistent manner. But only do this if
|
* the keycodes in a consistent manner. But only do this if
|
||||||
* Mousekeys is not enable, so it's not handled twice.
|
* Mousekeys is not enable, so it's not handled twice.
|
||||||
*/
|
*/
|
||||||
#ifndef MOUSEKEY_ENABLE
|
|
||||||
if (IS_MOUSEKEY_BUTTON(keycode)) {
|
|
||||||
report_mouse_t currentReport = pointing_device_get_report();
|
|
||||||
currentReport.buttons = pointing_device_handle_buttons(currentReport.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
|
||||||
pointing_device_set_report(currentReport);
|
|
||||||
pointing_device_send();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,20 +169,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
|
||||||
pointing_device_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
pointing_device_set_cpi(is_drag_scroll ? PLOOPY_DRAGSCROLL_DPI : dpi_array[keyboard_config.dpi_config]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If Mousekeys is disabled, then use handle the mouse button
|
|
||||||
* keycodes. This makes things simpler, and allows usage of
|
|
||||||
* the keycodes in a consistent manner. But only do this if
|
|
||||||
* Mousekeys is not enable, so it's not handled twice.
|
|
||||||
*/
|
|
||||||
#ifndef MOUSEKEY_ENABLE
|
|
||||||
if (IS_MOUSEKEY_BUTTON(keycode)) {
|
|
||||||
report_mouse_t currentReport = pointing_device_get_report();
|
|
||||||
currentReport.buttons = pointing_device_handle_buttons(currentReport.buttons, record->event.pressed, keycode - KC_MS_BTN1);
|
|
||||||
pointing_device_set_report(currentReport);
|
|
||||||
pointing_device_send();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -918,6 +918,10 @@ __attribute__((weak)) void register_code(uint8_t code) {
|
||||||
mousekey_on(code);
|
mousekey_on(code);
|
||||||
mousekey_send();
|
mousekey_send();
|
||||||
}
|
}
|
||||||
|
#elif defined(POINTING_DEVICE_ENABLE)
|
||||||
|
else if IS_MOUSEKEY (code) {
|
||||||
|
pointing_device_keycode_handler(code, true);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,6 +982,10 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
|
||||||
mousekey_off(code);
|
mousekey_off(code);
|
||||||
mousekey_send();
|
mousekey_send();
|
||||||
}
|
}
|
||||||
|
#elif defined(POINTING_DEVICE_ENABLE)
|
||||||
|
else if IS_MOUSEKEY (code) {
|
||||||
|
pointing_device_keycode_handler(code, false);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#ifdef MOUSEKEY_ENABLE
|
#ifdef MOUSEKEY_ENABLE
|
||||||
# include "mousekey.h"
|
# include "mousekey.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(POINTING_DEVICE_ROTATION_90) + defined(POINTING_DEVICE_ROTATION_180) + defined(POINTING_DEVICE_ROTATION_270)) > 1
|
#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.
|
# error More than one rotation selected. This is not supported.
|
||||||
#endif
|
#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);
|
return pointing_device_combine_reports(left_report, right_report);
|
||||||
}
|
}
|
||||||
#endif
|
#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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
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);
|
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);
|
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)
|
#if defined(SPLIT_POINTING_ENABLE)
|
||||||
void pointing_device_set_shared_report(report_mouse_t report);
|
void pointing_device_set_shared_report(report_mouse_t report);
|
||||||
|
|
Loading…
Reference in a new issue