From 106ed7e232494c680d2af233e1bded4b3edc0012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF=E3=83=BC=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=83=91=E3=83=BC?= <76888457+filterpaper@users.noreply.github.com> Date: Mon, 19 Aug 2024 10:18:28 +0800 Subject: [PATCH] Enhance overlapping mouse keys control (#23341) Enhance the overlapping mouse key press acceleration (introduced in #21494) with user preprocessor controls. --- quantum/mousekey.c | 10 +++++----- quantum/mousekey.h | 10 ++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/quantum/mousekey.c b/quantum/mousekey.c index 39108117524b..3457b1cd6d69 100644 --- a/quantum/mousekey.c +++ b/quantum/mousekey.c @@ -391,18 +391,18 @@ void mousekey_on(uint8_t code) { } # endif -# ifndef MOUSEKEY_INERTIA +# if defined(MOUSEKEY_OVERLAP_RESET) && !defined(MOUSEKEY_INERTIA) // If mouse report is not zero, the current mousekey press is overlapping // with another. Restart acceleration for smoother directional transition. if (mouse_report.x || mouse_report.y || mouse_report.h || mouse_report.v) { # ifdef MK_KINETIC_SPEED - mouse_timer = timer_read() - (MOUSEKEY_INTERVAL << 2); + mouse_timer = timer_read() - MOUSEKEY_OVERLAP_INTERVAL; # else - mousekey_repeat = MOUSEKEY_MOVE_DELTA; - mousekey_wheel_repeat = MOUSEKEY_WHEEL_DELTA; + mousekey_repeat = MOUSEKEY_OVERLAP_MOVE_DELTA; + mousekey_wheel_repeat = MOUSEKEY_OVERLAP_WHEEL_DELTA; # endif } -# endif // ifndef MOUSEKEY_INERTIA +# endif // defined(MOUSEKEY_OVERLAP_RESET) && !defined(MOUSEKEY_INERTIA) # ifdef MOUSEKEY_INERTIA diff --git a/quantum/mousekey.h b/quantum/mousekey.h index 73380b743a7b..e7a790b9a979 100644 --- a/quantum/mousekey.h +++ b/quantum/mousekey.h @@ -174,6 +174,16 @@ along with this program. If not, see . #endif /* #ifndef MK_3_SPEED */ +#ifndef MOUSEKEY_OVERLAP_MOVE_DELTA +# define MOUSEKEY_OVERLAP_MOVE_DELTA MOUSEKEY_MOVE_DELTA +#endif +#ifndef MOUSEKEY_OVERLAP_WHEEL_DELTA +# define MOUSEKEY_OVERLAP_WHEEL_DELTA MOUSEKEY_WHEEL_DELTA +#endif +#ifndef MOUSEKEY_OVERLAP_INTERVAL +# define MOUSEKEY_OVERLAP_INTERVAL MOUSEKEY_INTERVAL +#endif + #ifdef __cplusplus extern "C" { #endif