From 31335a04ed9bc01fd3ede33afde40d6f3359f2e9 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Wed, 5 Apr 2023 22:08:38 +0300 Subject: TWin: Active borders and snap tiling This commit is a squash of the commits of TDE/tdebase#331. In short, this backports some improvements to existing electric border functionality from KDE, adds the snap tiling (or aerosnap) feature and brings rudimentary support for active corners, which will be fully implemented in a later PR. The options dialog and the documentation has been updated to reflect these changes. Additionally, a new relevant option is introduced: an option for restoring the original size of maximized/tiled windows when the user starts dragging them. The option is set to be off by default, preserving the traditional behaviour of KDE 3.x/TDE. Last but not least, the term "electric" in relation to borders and corners is replaced by "active" for clarity to the users. Signed-off-by: Mavridis Philippe --- twin/options.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'twin/options.cpp') diff --git a/twin/options.cpp b/twin/options.cpp index ce35f6d06..3d237255b 100644 --- a/twin/options.cpp +++ b/twin/options.cpp @@ -31,8 +31,8 @@ namespace KWinInternal #ifndef KCMRULES Options::Options() - : electric_borders( 0 ), - electric_border_delay(0) + : active_borders( 0 ), + active_border_delay(0) { d = new KDecorationOptionsPrivate; d->defaultKWinSettings(); @@ -54,6 +54,7 @@ unsigned long Options::updateSettings() moveMode = stringToMoveResizeMode( config->readEntry("MoveMode", "Opaque" )); resizeMode = stringToMoveResizeMode( config->readEntry("ResizeMode", "Opaque" )); show_geometry_tip = config->readBoolEntry("GeometryTip", false); + reset_maximized_window_geometry = config->readBoolEntry("ResetMaximizedWindowGeometry", false); tabboxOutline = config->readBoolEntry("TabboxOutline", true); TQString val; @@ -125,8 +126,16 @@ unsigned long Options::updateSettings() borderSnapZone = config->readNumEntry("BorderSnapZone", 10); windowSnapZone = config->readNumEntry("WindowSnapZone", 10); snapOnlyWhenOverlapping=config->readBoolEntry("SnapOnlyWhenOverlapping",FALSE); - electric_borders = config->readNumEntry("ElectricBorders", 0); - electric_border_delay = config->readNumEntry("ElectricBorderDelay", 150); + + // active borders: compatibility with old option names (Electric*) + active_borders = config->readNumEntry("ActiveBorders", -1); + if (active_borders == -1) { + active_borders = config->readNumEntry("ElectricBorders", 0); + } + active_border_delay = config->readNumEntry("ActiveBorderDelay", -1); + if (active_border_delay == -1) { + active_border_delay = config->readNumEntry("ElectricBorderDelay", 150); + } OpTitlebarDblClick = windowOperation( config->readEntry("TitlebarDoubleClickCommand", "Shade"), true ); d->OpMaxButtonLeftClick = windowOperation( config->readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true ); @@ -308,6 +317,11 @@ bool Options::showGeometryTip() return show_geometry_tip; } +bool Options::resetMaximizedWindowGeometry() + { + return reset_maximized_window_geometry; + } + TQColor &Options::shadowColour(bool active) { return active ? shadow_colour : shadow_inactive_colour; @@ -373,14 +387,14 @@ int Options::shadowYOffset(bool active) return active ? shadow_y_offset : shadow_inactive_y_offset; } -int Options::electricBorders() +int Options::activeBorders() { - return electric_borders; + return active_borders; } -int Options::electricBorderDelay() +int Options::activeBorderDelay() { - return electric_border_delay; + return active_border_delay; } bool Options::checkIgnoreFocusStealing( const Client* c ) -- cgit v1.2.1