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
This commit is contained in:
parent
5d54cf9445
commit
5945dd1131
2 changed files with 8 additions and 1 deletions
|
@ -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<EffectsHandlerImpl*>( effects )->borderActivated( border ))
|
||||
{} // Handled by effects
|
||||
else
|
||||
{
|
||||
electricBorderSwitchDesktop( border, pos );
|
||||
return;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue