Make remote input sensitivity consistant across device DPIs
ClosedPublic

Authored by chansolyang on Jul 6 2018, 2:24 PM.

Details

Summary

KDEConnect's Remote Input feature does not take display DPI into account, resulting in inconsistent mouse sensitivities for devices with different DPIs.
This revision aims to fix that by dividing the mouse delta with the relative DPI of the current device. By doing so, the same amount of finger movement should produce the same amount of cursor movement, regardless of the device's DPI.

Addresses the following bug:
BUG: 391029

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.Jul 6 2018, 2:24 PM
Restricted Application added a project: KDE Connect. · View Herald TranscriptJul 6 2018, 2:24 PM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
chansolyang requested review of this revision.Jul 6 2018, 2:24 PM

This is my first contribution to the KDE codebase, so please let me know if I had made any mistakes!

nicolasfella added a subscriber: nicolasfella.EditedJul 8 2018, 1:50 PM

Thanks for your patch! You did alright, but for your next patch it would be even better if you use arc for uploading patches. It makes our and your life easier.

Your work looks sane to me and doen't regress anything for me, but I can't really comment on whether it actually improves things. I've asked some more people to test it.

sredman added a subscriber: sredman.Jul 8 2018, 6:32 PM

Thanks for your contribution!
Can you please describe how this should be tested?

On my phone, I changed the DPI then rebooted, and the behavior on this patch vs. master is about the same: Moving my finger from one side of the screen to the other produces about the same amount of cursor movement regardlesss of the DPI (Although it is a very different amount between this patch and master)

Comparing my tablet to my phone, the finger movement on master was very little. However, with this patch I get about the same amount of cursor movement for one full phone screen on the phone or on the tablet. Is this what you intended? I don't understand Android well enough to know why changing the DPI on my phone didn't make any difference!

Thanks everyone for the feedback.

Can you please describe how this should be tested?

I used the following method to test this:
First make sure that in plugin settings > remote input settings, the touchpad sensitivity is reset to Default.
Move your finger by some exact distance - I've personally used a ruler for this.
Record the mouse coordinates before and after moving the finger. (xdotool getmouselocation may come in handy here)
Divide the mouse movement by finger movement, and you will have the sensitivity in pixels/inch or pixels/cm.
If this patch works as intended, the calculated sensitivity will remain constant across all devices and DPIs.

I personally tested this with three devices: Galaxy Tab 7.0 (170dpi), Galaxy S3 (270dpi), and LG G5 (565dpi).
When tested, all three devices had a consistent sensitivity of about 220px/inch (=85px/cm). It would be great if others could confirm that they are also able to get this value of ~220px/inch.

On my phone, I changed the DPI then rebooted, and the behavior on this patch vs. master is about the same: Moving my finger from one side of the screen to the other produces about the same amount of cursor movement regardlesss of the DPI (Although it is a very different amount between this patch and master)

That is the intended behavior: the same amount(distance) of physical finger movement should always result in the same amount of cursor movement, regardless of device or dpi settings. However, I'm not sure why master has the same behavior; the original bug report stated that changing the device resolution(DPI) changed the mouse sensitivity. Can you make sure that you actually changed the display resolution, not font sizes or scaling?

I get about the same amount of cursor movement for one full phone screen on the phone or on the tablet.

So, what you're saying is: moving your finger across the entire screen, both on the phone and on the tablet, produces the same amount of cursor movement? What are the physical screen dimensions of the two devices?

Thanks everyone for the feedback.

Can you please describe how this should be tested?

I used the following method to test this:
First make sure that in plugin settings > remote input settings, the touchpad sensitivity is reset to Default.
Move your finger by some exact distance - I've personally used a ruler for this.
Record the mouse coordinates before and after moving the finger. (xdotool getmouselocation may come in handy here)
Divide the mouse movement by finger movement, and you will have the sensitivity in pixels/inch or pixels/cm.
If this patch works as intended, the calculated sensitivity will remain constant across all devices and DPIs.

In that case, from my point of view, it seems to be working as intended. I was much less precise that you, though :)

I personally tested this with three devices: Galaxy Tab 7.0 (170dpi), Galaxy S3 (270dpi), and LG G5 (565dpi).
When tested, all three devices had a consistent sensitivity of about 220px/inch (=85px/cm). It would be great if others could confirm that they are also able to get this value of ~220px/inch.

On my phone, I changed the DPI then rebooted, and the behavior on this patch vs. master is about the same: Moving my finger from one side of the screen to the other produces about the same amount of cursor movement regardlesss of the DPI (Although it is a very different amount between this patch and master)

That is the intended behavior: the same amount(distance) of physical finger movement should always result in the same amount of cursor movement, regardless of device or dpi settings. However, I'm not sure why master has the same behavior; the original bug report stated that changing the device resolution(DPI) changed the mouse sensitivity. Can you make sure that you actually changed the display resolution, not font sizes or scaling?

I changed something which said "dpi". Hopefully that means it was actually changing the dpi, but possibly it was doing something else in the background.

I get about the same amount of cursor movement for one full phone screen on the phone or on the tablet.

So, what you're saying is: moving your finger across the entire screen, both on the phone and on the tablet, produces the same amount of cursor movement? What are the physical screen dimensions of the two devices?

No; I think in this case the patch functions as intended: Moving my finger the same distance (about 2.5") produces the same cursor movement on both devices
The tablet is 10.1", the phone is 5"

nicolasfella accepted this revision.Jul 20 2018, 8:01 PM
This revision is now accepted and ready to land.Jul 20 2018, 8:01 PM

To push this patch I will need your email address

To push this patch I will need your email address

It's cosmicsubspace@gmail.com

This revision was automatically updated to reflect the committed changes.