Add acceleration to remote input cursor
ClosedPublic

Authored by chansolyang on Aug 10 2018, 8:37 AM.

Details

Summary

This patch adds cursor acceleration to KDEConnect's remote input plugin. The cursor movement is now scaled down if the movement is slow, and scaled up if the movement is fast.
The acceleration is implemented on the android side. An additional setting was added to the android app's Remote Control plugin preferences, allowing the user to choose the strength of the acceleration, or to disable the acceleration completely.

Test Plan

After installing this revision on your android device, go to the remote input page and start using the mousepad. Cursor acceleration should be enabled by default.
Check if the cursor acceleration is intuitive and easy to use. Also, try tweaking the acceleration in the Remote input settings in the Plugin settings menu.

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
chansolyang created this revision.Aug 10 2018, 8:37 AM
Restricted Application added a project: KDE Connect. · View Herald TranscriptAug 10 2018, 8:37 AM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
chansolyang requested review of this revision.Aug 10 2018, 8:37 AM

Thanks a lot for implementing this! Moving the cursor now feels really good. My perfect config is with sensitivity: "above default" and acceleration: "weaker" :)

I've added a comment inline with one thing I would change.

src/org/kde/kdeconnect/Plugins/MousePadPlugin/PointerAccelerationProfileFactory.java
20

I don't like this making an allocation every frame... Maybe you can change it so it's not needed? Eg: Making accumulatedX and accumulatedY public, and adding a resetMouseDelta() function to set them to zero, or allocating a single MouseDelta and reusing that one.

What do you think?

Reuse MouseDelta objects

chansolyang added inline comments.Aug 13 2018, 7:48 PM
src/org/kde/kdeconnect/Plugins/MousePadPlugin/PointerAccelerationProfileFactory.java
20

I'm not sure if allocating a tiny object every frame would be that much of a performance hit, but that's a fair point.
I've updated the code so that the MouseDelta objects will be reused.

albertvaka accepted this revision.Aug 13 2018, 9:50 PM
This revision is now accepted and ready to land.Aug 13 2018, 9:50 PM
This revision was automatically updated to reflect the committed changes.