From 53aaaf471d3c3849b51c71aa5d3d1a3aef799948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 8 Sep 2009 20:01:16 +0000 Subject: [PATCH] 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 --- options.cpp | 1 + options.h | 6 ++++++ workspace.cpp | 7 ++++++- 3 files changed, 13 insertions(+), 1 deletion(-) 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 ) &&