Bug 384769 - Kwin: Mouse pointer inaccurate when closing/resizing windows due to scaling factor
Summary: Kwin: Mouse pointer inaccurate when closing/resizing windows due to scaling f...
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: input (show other bugs)
Version: 5.10.95
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 384767 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-09-16 11:46 UTC by Rainer Finke
Modified: 2017-10-11 04:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
mgraesslin: Wayland+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Finke 2017-09-16 11:46:47 UTC
On Plasma 5.10.95 (5.11 beta) the mouse pointer is very inaccurate when closing/resizing windows due to the scaling factor on Wayland which is automatically applied on my 4k screen. The mouse seems to jump from one point to another and the mouse pointer symbols change unreliable.
Comment 1 Martin Flöser 2017-09-16 15:24:31 UTC
Sorry, but I don't understand what you mean by this. Especially not with closing/resizing windows. Could you please describe in more details what you are doing. Best would be something like:

Steps to reproduce:
1. Do this
2. Do that
3. then that

Expected behavior:
what I expect to happen

Actual behavior:
What really happens.
Comment 2 Rainer Finke 2017-09-16 16:20:26 UTC
In systemsettings there is a scaling factor of 1x and 2x on Wayland. 2x is applied on my 4k screen automatically. So you first have to apply this, if you don't have scaling enabled yet. 
Then take a window that is not fullscreen. Either move the mouse pointer to an area where you are able to resize the window or where you are able to close the window with the x in the right corner. You don't have to actually resize or close, it is just about the mouse pointer behaviour itself.
Expected result: normal mouse pointer behavior without any strange movements (jumps). Actually the mouse pointer jumps some milimeters like when the border areas are technically the same as what you see on the scren, it doesn't look or feel accurate at all. Without scaling it is fine.
Comment 3 Rainer Finke 2017-09-16 17:25:14 UTC
Sorry, I need to correct one of my sentences!

... Actually the mouse pointer jumps some milimeters like when the border areas are not technically the same as what you see on the screen, it doesn't look or feel accurate at all. ...
Comment 4 David Edmundson 2017-09-17 10:34:49 UTC
So the bug is in the DRM hardware cursor rendering, we're not scaling it, but we are implicitly scaling the hotpost. 

Leading to everything being ever so slighlty off, particularly when you change cursors. 

The obvious fix is that I should scale the cursor, but then I hit this damn issue again of the user needing different settings depending on whether they're on Wayland or not.
Comment 5 Martin Flöser 2017-09-17 11:08:46 UTC
@David: as the cursor is just a wl_surface: maybe we do get the information of whether it should be scaled as well. If the applications send us a scale on the cursor we could incorporate that in the DRM platform.
Comment 6 David Edmundson 2017-09-18 10:58:42 UTC
I've made a safe patch for 5.11, that fixes the immediate bug.

But I need to revisit this, probably in master.

You're right I can extract the source scale, but doing something useful with that is trickier. 

We have the problem that the dumb buffers are currently shared between the outputs, those outputs might be scaled differently - and we need those buffers in the correct target size.
Comment 7 David Edmundson 2017-09-18 15:40:33 UTC
Git commit 4238218b762996b41480f8d1c9a1c88930e08a11 by David Edmundson.
Committed on 18/09/2017 at 15:40.
Pushed by davidedmundson into branch 'Plasma/5.11'.

Don't scale cursor hotspot differently to cursor

Summary:
In the DRM plugin the cursor is currently is drawn at the native size
given.
Therefore we don't want to scale the icon offset as that leads to it
being drawn every so slightly off-sync.
Fixed-in: 5.11.0

Test Plan:
Kate now selects lines based on the middle of the cursor, not the top left.
I'd previously gotten so used to it, I hadn't realised it was actually a bug  :/

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7868

M  +1    -2    plugins/platforms/drm/drm_backend.cpp
M  +1    -1    plugins/platforms/drm/drm_output.cpp

https://commits.kde.org/kwin/4238218b762996b41480f8d1c9a1c88930e08a11
Comment 8 Martin Flöser 2017-10-11 04:24:04 UTC
*** Bug 384767 has been marked as a duplicate of this bug. ***