diff --git a/events.cpp b/events.cpp index d84c0d8e46..bd9ea47b16 100644 --- a/events.cpp +++ b/events.cpp @@ -1344,9 +1344,9 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot) } if (mode != QuickTileNone) { - if (yroot <= area.y() + area.height() / 4) + if (yroot <= area.y() + area.height() * options->electricBorderCornerRatio()) mode |= QuickTileTop; - else if (yroot >= area.y() + area.height() - area.height() / 4) + else if (yroot >= area.y() + area.height() - area.height() * options->electricBorderCornerRatio()) mode |= QuickTileBottom; } else if (options->electricBorderMaximize() && yroot <= area.y() + 5 && isMaximizable()) mode = QuickTileMaximize; diff --git a/options.cpp b/options.cpp index cd96e1be5c..50db58d541 100644 --- a/options.cpp +++ b/options.cpp @@ -187,6 +187,7 @@ Options::Options(QObject *parent) , electric_border_pushback_pixels(Options::defaultElectricBorderPushbackPixels()) , electric_border_maximize(Options::defaultElectricBorderMaximize()) , electric_border_tiling(Options::defaultElectricBorderTiling()) + , electric_border_corner_ratio(Options::defaultElectricBorderCornerRatio()) , borderless_maximized_windows(Options::defaultBorderlessMaximizedWindows()) , show_geometry_tip(Options::defaultShowGeometryTip()) , animationSpeed(Options::defaultAnimationSpeed()) @@ -582,6 +583,15 @@ void Options::setElectricBorderTiling(bool electricBorderTiling) emit electricBorderTilingChanged(); } +void Options::setElectricBorderCornerRatio(float electricBorderCornerRatio) +{ + if (electric_border_corner_ratio == electricBorderCornerRatio) { + return; + } + electric_border_corner_ratio = electricBorderCornerRatio; + emit electricBorderCornerRatioChanged(); +} + void Options::setBorderlessMaximizedWindows(bool borderlessMaximizedWindows) { if (borderless_maximized_windows == borderlessMaximizedWindows) { @@ -876,6 +886,8 @@ unsigned long Options::loadConfig() setElectricBorderPushbackPixels(config.readEntry("ElectricBorderPushbackPixels", Options::defaultElectricBorderPushbackPixels())); setElectricBorderMaximize(config.readEntry("ElectricBorderMaximize", Options::defaultElectricBorderMaximize())); setElectricBorderTiling(config.readEntry("ElectricBorderTiling", Options::defaultElectricBorderTiling())); + const float ebr = config.readEntry("ElectricBorderCornerRatio", Options::defaultElectricBorderCornerRatio()); + setElectricBorderCornerRatio(qMin(qMax(ebr, 0.0f), 1.0f)); OpTitlebarDblClick = windowOperation(config.readEntry("TitlebarDoubleClickCommand", "Maximize"), true); setOpMaxButtonLeftClick(windowOperation(config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true)); diff --git a/options.h b/options.h index 3acc17dbff..8069d7b0d2 100644 --- a/options.h +++ b/options.h @@ -155,6 +155,10 @@ class Options : public QObject, public KDecorationOptions * Whether a window is tiled to half screen when reaching left or right screen edge while been moved */ Q_PROPERTY(bool electricBorderTiling READ electricBorderTiling WRITE setElectricBorderTiling NOTIFY electricBorderTilingChanged) + /** + * Whether a window is tiled to half screen when reaching left or right screen edge while been moved + */ + Q_PROPERTY(float electricBorderCornerRatio READ electricBorderCornerRatio WRITE setElectricBorderCornerRatio NOTIFY electricBorderCornerRatioChanged) Q_PROPERTY(bool borderlessMaximizedWindows READ borderlessMaximizedWindows WRITE setBorderlessMaximizedWindows NOTIFY borderlessMaximizedWindowsChanged) /** * timeout before non-responding application will be killed after attempt to close @@ -480,6 +484,12 @@ public: bool electricBorderTiling() const { return electric_border_tiling; } + /** + * @returns the factor that determines the corner part of the edge (ie. 0.1 means tiny corner) + */ + float electricBorderCornerRatio() const { + return electric_border_corner_ratio; + } bool borderlessMaximizedWindows() const { return borderless_maximized_windows; @@ -611,6 +621,7 @@ public: void setElectricBorderPushbackPixels(int electricBorderPushbackPixels); void setElectricBorderMaximize(bool electricBorderMaximize); void setElectricBorderTiling(bool electricBorderTiling); + void setElectricBorderCornerRatio(float electricBorderCornerRatio); void setBorderlessMaximizedWindows(bool borderlessMaximizedWindows); void setKillPingTimeout(int killPingTimeout); void setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive); @@ -788,6 +799,9 @@ public: static bool defaultElectricBorderTiling() { return true; } + static float defaultElectricBorderCornerRatio() { + return 0.25; + } static bool defaultBorderlessMaximizedWindows() { return false; } @@ -914,6 +928,7 @@ Q_SIGNALS: void electricBorderPushbackPixelsChanged(); void electricBorderMaximizeChanged(); void electricBorderTilingChanged(); + void electricBorderCornerRatioChanged(); void borderlessMaximizedWindowsChanged(); void killPingTimeoutChanged(); void hideUtilityWindowsForInactiveChanged(); @@ -1014,6 +1029,7 @@ private: int electric_border_pushback_pixels; bool electric_border_maximize; bool electric_border_tiling; + float electric_border_corner_ratio; bool borderless_maximized_windows; bool show_geometry_tip; int animationSpeed; // 0 - instant, 5 - very slow