From 55daad4d6820950191ec7d30078edf9a0545ddec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Wed, 17 Jul 2013 16:39:58 +0200 Subject: [PATCH] sanitize screenedge activation timer logics The logics relied on a static timout to arm the timer: when last successfull activation had been longer ago than 250ms. We now cap the configured reactivation timeout at min 250m guessing that this was somehow supposed as well by this. BUG: 322057 FIXED-IN: 4.11 REVIEW: 111549 --- screenedge.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/screenedge.cpp b/screenedge.cpp index 0133983826..3d04f13d1a 100644 --- a/screenedge.cpp +++ b/screenedge.cpp @@ -47,8 +47,6 @@ along with this program. If not, see . namespace KWin { -// Reset timeout -static const int TRESHOLD_RESET = 250; // Mouse should not move more than this many pixels static const int DISTANCE_RESET = 30; @@ -133,7 +131,7 @@ void Edge::check(const QPoint &cursorPos, const QDateTime &triggerTime, bool for bool directActivate = forceNoPushBack || edges()->cursorPushBackDistance().isNull(); if (directActivate || canActivate(cursorPos, triggerTime)) { m_lastTrigger = triggerTime; - m_lastReset = triggerTime; + m_lastReset = QDateTime(); // invalidate handle(cursorPos); } else { pushCursorBack(cursorPos); @@ -143,7 +141,11 @@ void Edge::check(const QPoint &cursorPos, const QDateTime &triggerTime, bool for bool Edge::canActivate(const QPoint &cursorPos, const QDateTime &triggerTime) { - if (m_lastReset.msecsTo(triggerTime) > TRESHOLD_RESET) { + // we check whether either the timer has explicitly been invalidated (successfull trigger) or is + // bigger than the reactivation threshold (activation "aborted", usually due to moving away the cursor + // from the corner after successfull activation) + // either condition means that "this is the first event in a new attempt" + if (!m_lastReset.isValid() || m_lastReset.msecsTo(triggerTime) > edges()->reActivationThreshold()) { m_lastReset = triggerTime; return false; }