From 5945dd113184c020938c9dc1e63ee11b96ff8106 Mon Sep 17 00:00:00 2001 From: Lucas Murray Date: Tue, 10 Feb 2009 06:22:04 +0000 Subject: [PATCH] If an effect is triggered by an electric border "push" the cursor back out of the triggering area and disallow a retrigger for 350ms. Prevents accidental deactivation of effect when leaving the cursor in the hotspot. svn path=/trunk/KDE/kdebase/workspace/; revision=924111 --- workspace.cpp | 8 +++++++- workspace.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/workspace.cpp b/workspace.cpp index 1ec5ca2eff..f6972e2f29 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -2128,6 +2128,7 @@ void Workspace::updateElectricBorders() { electric_time_first = xTime(); electric_time_last = xTime(); + electric_time_last_trigger = xTime(); electric_current_border = ElectricNone; QRect r = Kephal::ScreenUtils::desktopGeometry(); electricTop = r.top(); @@ -2226,6 +2227,7 @@ void Workspace::checkElectricBorder(const QPoint& pos, Time now) Time treshold_set = options->electricBorderDelay(); // Set timeout Time treshold_reset = 250; // Reset timeout + Time treshold_trigger = 350; // Minimum time between triggers int distance_reset = 30; // Mouse should not move more than this many pixels ElectricBorder border; @@ -2253,6 +2255,7 @@ void Workspace::checkElectricBorder(const QPoint& pos, Time now) if(( electric_current_border == border ) && ( timestampDiff( electric_time_last, now ) < treshold_reset ) && + ( timestampDiff( electric_time_last_trigger, now ) > treshold_trigger ) && (( pos-electric_push_point ).manhattanLength() < distance_reset )) { electric_time_last = now; @@ -2260,11 +2263,14 @@ void Workspace::checkElectricBorder(const QPoint& pos, Time now) if( timestampDiff( electric_time_first, now ) > treshold_set ) { electric_current_border = ElectricNone; + electric_time_last_trigger = now; if( effects && static_cast( effects )->borderActivated( border )) {} // Handled by effects else + { electricBorderSwitchDesktop( border, pos ); - return; + return; + } } } else diff --git a/workspace.h b/workspace.h index 79889c966a..7e12a2514b 100644 --- a/workspace.h +++ b/workspace.h @@ -741,6 +741,7 @@ class Workspace : public QObject, public KDecorationDefines int electricBottom; Time electric_time_first; Time electric_time_last; + Time electric_time_last_trigger; QPoint electric_push_point; int electric_reserved[ELECTRIC_COUNT]; // Corners/edges used by something