summary refs log tree commit diff
path: root/quantum/mousekey.h
diff options
context:
space:
mode:
authorSelene ToyKeeper <ToyKeeper@users.noreply.github.com>2022-10-26 13:49:44 -0600
committerGitHub <noreply@github.com>2022-10-26 20:49:44 +0100
commit2a61bfc27d6915877d18a09bc440d462a2051857 (patch)
tree72070605dda5410359774a33f52f0a459b8b184e /quantum/mousekey.h
parent4c0c491e31535292194cc812cde483d223d16ed7 (diff)
add "inertia" mode for mouse keys (#18774)
Co-authored-by: Selene ToyKeeper <git@toykeeper.net>
Diffstat (limited to 'quantum/mousekey.h')
-rw-r--r--quantum/mousekey.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/quantum/mousekey.h b/quantum/mousekey.h
index da2edb481a..e968e000c0 100644
--- a/quantum/mousekey.h
+++ b/quantum/mousekey.h
@@ -36,34 +36,48 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #    endif
 
 #    ifndef MOUSEKEY_MOVE_DELTA
-#        ifndef MK_KINETIC_SPEED
-#            define MOUSEKEY_MOVE_DELTA 8
-#        else
+#        if defined(MK_KINETIC_SPEED)
 #            define MOUSEKEY_MOVE_DELTA 16
+#        elif defined(MOUSEKEY_INERTIA)
+#            define MOUSEKEY_MOVE_DELTA 1
+#        else
+#            define MOUSEKEY_MOVE_DELTA 8
 #        endif
 #    endif
 #    ifndef MOUSEKEY_WHEEL_DELTA
 #        define MOUSEKEY_WHEEL_DELTA 1
 #    endif
 #    ifndef MOUSEKEY_DELAY
-#        ifndef MK_KINETIC_SPEED
-#            define MOUSEKEY_DELAY 10
-#        else
+#        if defined(MK_KINETIC_SPEED)
 #            define MOUSEKEY_DELAY 5
+#        elif defined(MOUSEKEY_INERTIA)
+#            define MOUSEKEY_DELAY 150 // allow single-pixel movements before repeat activates
+#        else
+#            define MOUSEKEY_DELAY 10
 #        endif
 #    endif
 #    ifndef MOUSEKEY_INTERVAL
-#        ifndef MK_KINETIC_SPEED
-#            define MOUSEKEY_INTERVAL 20
-#        else
+#        if defined(MK_KINETIC_SPEED)
 #            define MOUSEKEY_INTERVAL 10
+#        elif defined(MOUSEKEY_INERTIA)
+#            define MOUSEKEY_INTERVAL 16 // 60 fps
+#        else
+#            define MOUSEKEY_INTERVAL 20
 #        endif
 #    endif
 #    ifndef MOUSEKEY_MAX_SPEED
-#        define MOUSEKEY_MAX_SPEED 10
+#        if defined(MOUSEKEY_INERTIA)
+#            define MOUSEKEY_MAX_SPEED 32
+#        else
+#            define MOUSEKEY_MAX_SPEED 10
+#        endif
 #    endif
 #    ifndef MOUSEKEY_TIME_TO_MAX
-#        define MOUSEKEY_TIME_TO_MAX 30
+#        if defined(MOUSEKEY_INERTIA)
+#            define MOUSEKEY_TIME_TO_MAX 32
+#        else
+#            define MOUSEKEY_TIME_TO_MAX 30
+#        endif
 #    endif
 #    ifndef MOUSEKEY_WHEEL_DELAY
 #        define MOUSEKEY_WHEEL_DELAY 10
@@ -78,6 +92,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #        define MOUSEKEY_WHEEL_TIME_TO_MAX 40
 #    endif
 
+#    ifndef MOUSEKEY_FRICTION
+#        define MOUSEKEY_FRICTION 24 // 0 to 255
+#    endif
 #    ifndef MOUSEKEY_INITIAL_SPEED
 #        define MOUSEKEY_INITIAL_SPEED 100
 #    endif