When mouse tracking is enabled, zoom initially zooms into the location where the mouse cursor last was when an active zoom was zoomed all the way out. The zoom then may jump to the current location of the mouse cursor quickly with a brief stutter, or it may stay at the old erroneous location until the mouse is moved.
The cause is that cursorPoint (the point zoomed to) is not set until mouse polling is enabled and ZoomEffect::slotMouseChanged is called.
A simple fix is to add
cursorPoint = effects->cursorPos();
to the ZoomEffect::zoomIn(double to) method. This method sets prevPoint for MouseTrackingDisabled but does not set cursorPoint which is required when mouse tracking is enabled.
Bug observed in Proportional and Centered modes. Proposed fix tested in Proportional, Centered, and Push modes. Never used unpatched Push mode to watch for bug but it should be affected too since is uses cursorPoint. Bug is most obvious in proportional mode.
Platform is SolydK linux distribution.
Steps to Reproduce:
1.Enable Mouse Tracking in Proportional mode
2.Zoom in on one corner of the screen, move mouse a little, zoom out (while cursor is still in the same corner).
3.Move mouse cursor to opposite corner when zoomed all the way out then zoom in while cursor is stationary in that corner of the screen. Watch screen jump from previous corner to current one.
(Track balls make it easy to not move the mouse, with enough tries you can get it to zoom entirely to the old location and not hop to the new one until the mouse is moved.)
Zoom initially zooms to location where cursor was when last zoomed out, then jumps to the correct current cursor location.
Zoom should initially zoom to current cursor location.
Patch to fix the bug.
@@ -387,6 +387,7 @@ void ZoomEffect::zoomIn(double to)
polling = true;
+ cursorPoint = effects->cursorPos();
if (mouseTracking == MouseTrackingDisabled)
prevPoint = effects->cursorPos();
Created attachment 82734 [details]
Patch to correction initialize cursorPos at start of zoom
Do you have commit rights?
Otherwise please re-use cursorPoint for prevPoint below and attach a "git format-patch"
I don't have commit rights, signed up just to post this bug. The diff was generated by a commit to a deb source package. Never worked with git so I'll have to figure out how to give you what you asked for. If it's something you can easily do please feel free.
Created attachment 82758 [details]
(In reply to comment #2)
> Do you have commit rights?
> Otherwise please re-use cursorPoint for prevPoint below and attach a "git
Ok, I made the suggested change and added a "git format-patch" against tags/v4.11.2.
Let me know if I've done something wrong.
Git commit 4bbe80a68768b0714be7e6decdfa5880b8347723 by Martin Gräßlin, on behalf of C Schell.
Committed on 10/10/2013 at 04:50.
Pushed by graesslin into branch 'KDE/4.11'.
Fix zoom effect cursor position on initial zoom in.
M +2 -1 kwin/effects/zoom/zoom.cpp
Thanks a lot and congratulations to your first patch to KDE :-)
(In reply to comment #7)
> Thanks a lot and congratulations to your first patch to KDE :-)
You're welcome. And thanks for the quick commit and all the work you and the other devs do on KDE and Kwin.