Bug 327539

Summary: [desktop grid] Desktop highlight lost if cursor moves too fast
Product: [Plasma] kwin Reporter: Andreas Klöckner <inform>
Component: effects-window-managementAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 4.11.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.4
Sentry Crash Report:

Description Andreas Klöckner 2013-11-13 01:06:21 UTC
If I activate the desktop grid and then press "Cursor down" a few times reasonably quickly, then the highlight indicating which workspace is currently selected will disappear. Hitting Enter (as in, going back to full-size desktops) will show me what workspace is selected, but from the grid, I am unable to tell.

Reproducible: Always
Comment 1 Andreas Klöckner 2013-11-13 01:07:13 UTC
Not sure if it makes a difference, but I use a two-screen xinerama-ish multihead setup.
Comment 2 Martin Flöser 2013-11-13 05:58:55 UTC
I can trigger this problem also just with moving the mouse
Comment 3 Thomas Lübking 2013-11-13 13:46:48 UTC
Reason is obvious. Patch (not tested)

diff --git a/kwin/effects/desktopgrid/desktopgrid.cpp b/kwin/effects/desktopgrid/desktopgrid.cpp
index 7a53b52..e801653 100644
--- a/kwin/effects/desktopgrid/desktopgrid.cpp
+++ b/kwin/effects/desktopgrid/desktopgrid.cpp
@@ -914,7 +914,12 @@ void DesktopGridEffect::setHighlightedDesktop(int d)
 {
     if (d == highlightedDesktop || d <= 0 || d > effects->numberOfDesktops())
         return;
+    if (highlightedDesktop > 0 && highlightedDesktop <= hoverTimeline.count())
+        hoverTimeline[highlightedDesktop-1]->setCurrentTime(qMin(hoverTimeline[highlightedDesktop-1]->currentTime(),
+                                                                 hoverTimeline[highlightedDesktop-1]->duration()));
     highlightedDesktop = d;
+    if (highlightedDesktop <= hoverTimeline.count())
+        hoverTimeline[highlightedDesktop-1]->setCurrentTime(qMax(hoverTimeline[highlightedDesktop-1]->currentTime(), 0));
     effects->addRepaintFull();
 }


Time is added and removed from the timeline unclamped what can result in

currentTime = 0 - nextTimeAdd
-> currentTime = 0
-> repaint condition for active timeline not met.
Comment 4 Martin Flöser 2013-11-13 19:05:10 UTC
ShipIt (TM)
Comment 5 Thomas Lübking 2013-11-24 14:28:29 UTC
Git commit 746e93521cf24eef12b97a27e352288a1db4d1c1 by Thomas Lübking.
Committed on 16/11/2013 at 15:37.
Pushed by luebking into branch 'KDE/4.11'.

clamp timeline time for highlighted desktop
FIXED-IN: 4.11.4

M  +5    -0    kwin/effects/desktopgrid/desktopgrid.cpp

http://commits.kde.org/kde-workspace/746e93521cf24eef12b97a27e352288a1db4d1c1