21b84596e7c372eeeedcf41a32c6c25379cd8f0e

Author
フィルターペーパー <76888457+filterpaper@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

Enhance overlapping mouse keys control (#23341)

Enhance the overlapping mouse key press acceleration (introduced in #21494) with user preprocessor controls.

Diff

This diff is truncated to protect this page.

 1diff --git a/docs/features/mouse_keys.md b/docs/features/mouse_keys.md
 2index 4cc06c992aed9fe10488f4f27e7a9f7b019cee35..d755084f8e63696517cb622fc8161eef8a7a65a5 100644
 3--- a/docs/features/mouse_keys.md
 4+++ b/docs/features/mouse_keys.md
 5@@ -203,6 +203,19 @@ Tips:
 6 * Keep `MOUSEKEY_MOVE_DELTA` at 1.  This allows precise movements before the gliding effect starts.
 7 * Mouse wheel options are the same as the default accelerated mode, and do not use inertia.
 8 
 9+### Overlapping mouse key control
10+
11diff --git a/quantum/mousekey.c b/quantum/mousekey.c
12index 8683cfdffacb336d453aadf3b0cab85ef16b030d..9649943a0d4bb5233969d79832199333adaab05a 100644
13--- a/quantum/mousekey.c
14+++ b/quantum/mousekey.c
15@@ -391,18 +391,18 @@ void mousekey_on(uint8_t code) {
16     }
17 #    endif
18 
19-#    ifndef MOUSEKEY_INERTIA
20+#    if defined(MOUSEKEY_OVERLAP_RESET) && !defined(MOUSEKEY_INERTIA)
21     // If mouse report is not zero, the current mousekey press is overlapping
22     // with another. Restart acceleration for smoother directional transition.
23     if (mouse_report.x || mouse_report.y || mouse_report.h || mouse_report.v) {
24 #        ifdef MK_KINETIC_SPEED
25-        mouse_timer = timer_read() - (MOUSEKEY_INTERVAL << 2);
26+        mouse_timer = timer_read() - MOUSEKEY_OVERLAP_INTERVAL;
27 #        else
28-        mousekey_repeat       = MOUSEKEY_MOVE_DELTA;
29-        mousekey_wheel_repeat = MOUSEKEY_WHEEL_DELTA;
30+        mousekey_repeat       = MOUSEKEY_OVERLAP_MOVE_DELTA;
31+        mousekey_wheel_repeat = MOUSEKEY_OVERLAP_WHEEL_DELTA;
32 #        endif
33     }
34-#    endif // ifndef MOUSEKEY_INERTIA
35+#    endif // defined(MOUSEKEY_OVERLAP_RESET) && !defined(MOUSEKEY_INERTIA)
36 
37 #    ifdef MOUSEKEY_INERTIA
38 
39diff --git a/quantum/mousekey.h b/quantum/mousekey.h
40index 73380b743a7be62fe1f917389a84e25a6d6b6183..e7a790b9a979aeacd4972c9d24563a20b921a930 100644
41--- a/quantum/mousekey.h
42+++ b/quantum/mousekey.h
43@@ -174,6 +174,16 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
44 
45 #endif /* #ifndef MK_3_SPEED */
46 
47+#ifndef MOUSEKEY_OVERLAP_MOVE_DELTA
48+#    define MOUSEKEY_OVERLAP_MOVE_DELTA MOUSEKEY_MOVE_DELTA
49+#endif
50+#ifndef MOUSEKEY_OVERLAP_WHEEL_DELTA
51+#    define MOUSEKEY_OVERLAP_WHEEL_DELTA MOUSEKEY_WHEEL_DELTA
52+#endif
53+#ifndef MOUSEKEY_OVERLAP_INTERVAL
54+#    define MOUSEKEY_OVERLAP_INTERVAL MOUSEKEY_INTERVAL
55+#endif
56+
57 #ifdef __cplusplus
58 extern "C" {
59 #endif