diff --git a/options.cpp b/options.cpp index ff9e8ebd01..38fadfd26d 100644 --- a/options.cpp +++ b/options.cpp @@ -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 ); diff --git a/options.h b/options.h index b399757fb5..625a541ca5 100644 --- a/options.h +++ b/options.h @@ -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; diff --git a/workspace.cpp b/workspace.cpp index 9efea05dd7..a1127293d0 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -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 ) &&