Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "inertia" mode for mouse keys #18774

Merged
merged 7 commits into from
Oct 26, 2022
Merged

Conversation

ToyKeeper
Copy link
Contributor

Description

I added a new mousekey motion mode called "inertia". It accelerates along a quadratic curve while a key is pressed, then decelerates smoothly after the key is released. It also tracks velocity for X and Y axes separately. Together, this makes the cursor motion fluid, like moving on ice.

In this mode, the mouse cursor can be moved in many directions and even make curves, instead of just straight lines. For example, I painted a few brush strokes in Gimp, using only the up/down/left/right mouse keys: pic

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

- decelerates smoothly after key release instead of an instant stop
- tracks X and Y velocity separately
- fixed occasional jerky movement while pressing multiple mousekeys quickly
- made friction more accurate and user-configurable
- converted floating-point math to integer
- reduced compiled size by 100+ bytes
(further testing showed it's still needed)
@drashna drashna requested a review from a team October 21, 2022 01:21
@ToyKeeper
Copy link
Contributor Author

If it helps at all, I got a couple people to try this patch on their hardware, and they shared their thoughts afterward. The first report I got back was:

After a lengthy process trying to actually be able to flash to this silly {keyboard} I am now finally messing around with your inertia code and I totally love it! Not only is the feel excellent but the control to tweak the acceleration and friction and stuff is so useful in creating a profile that really works for me. Thank you so much for putting this together and suggesting it to me!!

... and the second person to try it:

Just tried the Inertia mode. Very nice. I like how natural it feels and the fine cursor movements possible by tapping. I used the {default} settings but changed the mouse max speed to suit 1440p as per the comment.

So I'm hoping it can land soon.

@keyboard-magpie keyboard-magpie merged commit 2a61bfc into qmk:develop Oct 26, 2022
ramonimbao pushed a commit to ramonimbao/qmk_firmware that referenced this pull request Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants