[platforms/drm] Properly adjust cursor position on a rotated output
ClosedPublic

Authored by graesslin on Nov 2 2017, 5:15 PM.

Details

Summary

This change refactors the way how the cursor position on a screen is
calculated. It is changed to a matrix multiplication with the
adjustments for the rotated screen just being additional steps added to
the matrix.

With this calculation I got correct positions for all variants of
scaled, rotated and differently positioned outputs.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Nov 2 2017, 5:15 PM
Restricted Application added a project: KWin. · View Herald TranscriptNov 2 2017, 5:15 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
graesslin added a subscriber: davidedmundson.

@davidedmundson could you please verify that the scale is still applied correctly. I set my displays to scaled and moved them around and verified with mouse mark effect. Everything looks fine. But four eyes see more than two :-)

davidedmundson added inline comments.Nov 2 2017, 5:32 PM
plugins/platforms/drm/drm_output.cpp
109

for all variants of scaled, rotated and differently positioned outputs.

"by all variants of rotated" do you mean just this one?

116

I'm 95% sure you need to rotate your softwareCursorHotspot.

It's something hard to see, becuase you'll only be off by a few px.

The only reason I'm not scaling the offset is because we're not scaling the contents of the cursor planet (which is arguably wrong), you are rotating it.

graesslin added inline comments.Nov 2 2017, 6:40 PM
plugins/platforms/drm/drm_output.cpp
109

I meant, that I rotated the screen by 180 degree, scaled it, repositioned it, did the same for the other screen. On the system I test I can only rotate by 180 degrees, so the other variants will follow once I'm able to actually rotate by 90 degrees (I hope my yoga allows that).

Sorry that was not clearly formulated.

116

I didn't include that part on purpose. Currently it doesn't make sense yet as the cursor itself is not yet rotated, so it's clearly wrong. Whether it's rotated or not.

To actually get this right we first need to add support for rotating the cursor image (I already have figured out how to do it, but requires some refactoring).

davidedmundson accepted this revision.Nov 3 2017, 10:03 AM

I think there's still work to do, but we may as well merge this and base any new changes on top of that.

This revision is now accepted and ready to land.Nov 3 2017, 10:03 AM
This revision was automatically updated to reflect the committed changes.