Adding a new option to disable the cursor pushback for active screen edges.

I haven't added it to the UI as the screen edges kcm is already a little bit cluttered with complicated options.
So if you want to disable the pushback add option "ElectricBorderPushbackPixels" to section [Windows].
FEATURE: 198225

svn path=/trunk/KDE/kdebase/workspace/; revision=1021306
This commit is contained in:
Martin Gräßlin 2009-09-08 20:01:16 +00:00
parent 754f5d0829
commit 53aaaf471d
3 changed files with 13 additions and 1 deletions

View file

@ -143,6 +143,7 @@ unsigned long Options::updateSettings()
electric_borders = config.readEntry("ElectricBorders", 0);
electric_border_delay = config.readEntry("ElectricBorderDelay", 150);
electric_border_cooldown = config.readEntry("ElectricBorderCooldown", 350);
electric_border_pushback_pixels = config.readEntry("ElectricBorderPushbackPixels", 1);
electric_border_maximize = config.readEntry("ElectricBorderMaximize", false);
electric_border_tiling = config.readEntry("ElectricBorderTiling" , false );

View file

@ -290,6 +290,11 @@ class Options : public KDecorationOptions
*/
int electricBorderCooldown();
/**
* @returns the number of pixels the mouse cursor is pushed back when it
* reaches the screen edge.
*/
int electricBorderPushbackPixels() const { return electric_border_pushback_pixels; }
/**
* @returns true if a window gets maximized when it reaches top screen edge
* while being moved.
*/
@ -363,6 +368,7 @@ class Options : public KDecorationOptions
int electric_borders;
int electric_border_delay;
int electric_border_cooldown;
int electric_border_pushback_pixels;
bool electric_border_maximize;
bool electric_border_tiling;
bool show_geometry_tip;

View file

@ -2134,7 +2134,7 @@ void Workspace::checkElectricBorder(const QPoint& pos, Time now)
Time treshold_reset = 250; // Reset timeout
Time treshold_trigger = options->electricBorderCooldown(); // Minimum time between triggers
int distance_reset = 30; // Mouse should not move more than this many pixels
int pushback_pixels = 1;
int pushback_pixels = options->electricBorderPushbackPixels();
ElectricBorder border;
if( pos.x() == electricLeft && pos.y() == electricTop )
@ -2159,6 +2159,11 @@ void Workspace::checkElectricBorder(const QPoint& pos, Time now)
if( electric_windows[border] == None )
return;
if( pushback_pixels == 0 )
{
// no pushback so we have to activate at once
electric_time_last = now;
}
if(( electric_current_border == border ) &&
( timestampDiff( electric_time_last, now ) < treshold_reset ) &&
( timestampDiff( electric_time_last_trigger, now ) > treshold_trigger ) &&