Bug 351627

Summary: ScreenEdges::handleEnterNotifiy() an ScreenEdges::check() are called in a row, causing a double handleByCallback()
Product: [Plasma] kwin Reporter: Thomas Lübking <thomas.luebking>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.4.1

Description Thomas Lübking 2015-08-22 20:49:44 UTC
What leads to double activation of callbacks - in case of at least the tabbox that's a toggle and this means you get a "show();" first and then an "accept();" before you can even spot the tabbox.

Btw: "handleEnterNotifiy"? ;-P

Reproducible: Always
Comment 1 Thomas Lübking 2015-08-23 07:18:01 UTC
diff --git a/screenedge.cpp b/screenedge.cpp
index 35d84a0..b657675 100644
--- a/screenedge.cpp
+++ b/screenedge.cpp
@@ -137,6 +137,10 @@ bool Edge::check(const QPoint &cursorPos, const QDateTime &triggerTime, bool for
     if (!triggersFor(cursorPos)) {
         return false;
     }
+    if (m_lastTrigger.isValid() && // still in cooldown
+        m_lastTrigger.msecsTo(triggerTime) < edges()->reActivationThreshold()) {
+        return false;
+    }
     // no pushback so we have to activate at once
     bool directActivate = forceNoPushBack || edges()->cursorPushBackDistance().isNull() || m_client;
     if (directActivate || canActivate(cursorPos, triggerTime)) {
Comment 2 Martin Flöser 2015-08-24 06:43:40 UTC
Shouldn't be the check in Edge::canActivate?
Comment 3 Thomas Lübking 2015-08-24 06:46:39 UTC
Check is  there, but bypassed by the directActivate (notably the forceNoPushBack part) check.
Those however do not matter; during the cooldown, there must be no trigger.
Comment 4 Martin Flöser 2015-08-24 06:53:26 UTC
Sounds reasonable ;-) Thanks for explaining.
Comment 5 Thomas Lübking 2015-08-27 21:23:16 UTC
Git commit 9139cca72c5612482c8c27e70196d583630772af by Thomas Lübking.
Committed on 27/08/2015 at 20:21.
Pushed by luebking into branch 'Plasma/5.4'.

never trigger edges during the cooldown

regardless of whether the pushback is forced down or the user
has deactivated it or whatever. The edge is waiting from previous
activation and we need to prevent immediate reactivation since that
may cause duplicate action and unwanted state toggles
Related: bug 351869
FIXED-IN: 5.4.1
REVIEW: 124888

M  +4    -0    screenedge.cpp

http://commits.kde.org/kwin/9139cca72c5612482c8c27e70196d583630772af