add ElectricBorderCornerRatio setting [0,1]

REVIEW: 106509
CCBUG: 308993
This commit is contained in:
Thomas Lübking 2012-09-19 22:48:52 +02:00
parent 6cba742315
commit 0e69bdf0ed
3 changed files with 30 additions and 2 deletions

View file

@ -1344,9 +1344,9 @@ void Client::checkQuickTilingMaximizationZones(int xroot, int yroot)
} }
if (mode != QuickTileNone) { if (mode != QuickTileNone) {
if (yroot <= area.y() + area.height() / 4) if (yroot <= area.y() + area.height() * options->electricBorderCornerRatio())
mode |= QuickTileTop; 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; mode |= QuickTileBottom;
} else if (options->electricBorderMaximize() && yroot <= area.y() + 5 && isMaximizable()) } else if (options->electricBorderMaximize() && yroot <= area.y() + 5 && isMaximizable())
mode = QuickTileMaximize; mode = QuickTileMaximize;

View file

@ -187,6 +187,7 @@ Options::Options(QObject *parent)
, electric_border_pushback_pixels(Options::defaultElectricBorderPushbackPixels()) , electric_border_pushback_pixels(Options::defaultElectricBorderPushbackPixels())
, electric_border_maximize(Options::defaultElectricBorderMaximize()) , electric_border_maximize(Options::defaultElectricBorderMaximize())
, electric_border_tiling(Options::defaultElectricBorderTiling()) , electric_border_tiling(Options::defaultElectricBorderTiling())
, electric_border_corner_ratio(Options::defaultElectricBorderCornerRatio())
, borderless_maximized_windows(Options::defaultBorderlessMaximizedWindows()) , borderless_maximized_windows(Options::defaultBorderlessMaximizedWindows())
, show_geometry_tip(Options::defaultShowGeometryTip()) , show_geometry_tip(Options::defaultShowGeometryTip())
, animationSpeed(Options::defaultAnimationSpeed()) , animationSpeed(Options::defaultAnimationSpeed())
@ -582,6 +583,15 @@ void Options::setElectricBorderTiling(bool electricBorderTiling)
emit electricBorderTilingChanged(); 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) void Options::setBorderlessMaximizedWindows(bool borderlessMaximizedWindows)
{ {
if (borderless_maximized_windows == borderlessMaximizedWindows) { if (borderless_maximized_windows == borderlessMaximizedWindows) {
@ -876,6 +886,8 @@ unsigned long Options::loadConfig()
setElectricBorderPushbackPixels(config.readEntry("ElectricBorderPushbackPixels", Options::defaultElectricBorderPushbackPixels())); setElectricBorderPushbackPixels(config.readEntry("ElectricBorderPushbackPixels", Options::defaultElectricBorderPushbackPixels()));
setElectricBorderMaximize(config.readEntry("ElectricBorderMaximize", Options::defaultElectricBorderMaximize())); setElectricBorderMaximize(config.readEntry("ElectricBorderMaximize", Options::defaultElectricBorderMaximize()));
setElectricBorderTiling(config.readEntry("ElectricBorderTiling", Options::defaultElectricBorderTiling())); 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); OpTitlebarDblClick = windowOperation(config.readEntry("TitlebarDoubleClickCommand", "Maximize"), true);
setOpMaxButtonLeftClick(windowOperation(config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true)); setOpMaxButtonLeftClick(windowOperation(config.readEntry("MaximizeButtonLeftClickCommand", "Maximize"), true));

View file

@ -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 * 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) 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) Q_PROPERTY(bool borderlessMaximizedWindows READ borderlessMaximizedWindows WRITE setBorderlessMaximizedWindows NOTIFY borderlessMaximizedWindowsChanged)
/** /**
* timeout before non-responding application will be killed after attempt to close * timeout before non-responding application will be killed after attempt to close
@ -480,6 +484,12 @@ public:
bool electricBorderTiling() const { bool electricBorderTiling() const {
return electric_border_tiling; 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 { bool borderlessMaximizedWindows() const {
return borderless_maximized_windows; return borderless_maximized_windows;
@ -611,6 +621,7 @@ public:
void setElectricBorderPushbackPixels(int electricBorderPushbackPixels); void setElectricBorderPushbackPixels(int electricBorderPushbackPixels);
void setElectricBorderMaximize(bool electricBorderMaximize); void setElectricBorderMaximize(bool electricBorderMaximize);
void setElectricBorderTiling(bool electricBorderTiling); void setElectricBorderTiling(bool electricBorderTiling);
void setElectricBorderCornerRatio(float electricBorderCornerRatio);
void setBorderlessMaximizedWindows(bool borderlessMaximizedWindows); void setBorderlessMaximizedWindows(bool borderlessMaximizedWindows);
void setKillPingTimeout(int killPingTimeout); void setKillPingTimeout(int killPingTimeout);
void setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive); void setHideUtilityWindowsForInactive(bool hideUtilityWindowsForInactive);
@ -788,6 +799,9 @@ public:
static bool defaultElectricBorderTiling() { static bool defaultElectricBorderTiling() {
return true; return true;
} }
static float defaultElectricBorderCornerRatio() {
return 0.25;
}
static bool defaultBorderlessMaximizedWindows() { static bool defaultBorderlessMaximizedWindows() {
return false; return false;
} }
@ -914,6 +928,7 @@ Q_SIGNALS:
void electricBorderPushbackPixelsChanged(); void electricBorderPushbackPixelsChanged();
void electricBorderMaximizeChanged(); void electricBorderMaximizeChanged();
void electricBorderTilingChanged(); void electricBorderTilingChanged();
void electricBorderCornerRatioChanged();
void borderlessMaximizedWindowsChanged(); void borderlessMaximizedWindowsChanged();
void killPingTimeoutChanged(); void killPingTimeoutChanged();
void hideUtilityWindowsForInactiveChanged(); void hideUtilityWindowsForInactiveChanged();
@ -1014,6 +1029,7 @@ private:
int electric_border_pushback_pixels; int electric_border_pushback_pixels;
bool electric_border_maximize; bool electric_border_maximize;
bool electric_border_tiling; bool electric_border_tiling;
float electric_border_corner_ratio;
bool borderless_maximized_windows; bool borderless_maximized_windows;
bool show_geometry_tip; bool show_geometry_tip;
int animationSpeed; // 0 - instant, 5 - very slow int animationSpeed; // 0 - instant, 5 - very slow