Commit fb862b7e authored by Martin Flöser's avatar Martin Flöser
Browse files

Extended Border support in Aurorae

Aurorae Themes can make use of the extended borders feature to allow
resizing outside the window decoration area. So far only Plastik makes
use of it in the Tiny border case.

This should be extended in future by adding generic NoSideBorders and
NoBorders sizes as used by Oxygen.

FEATURE: 308992
FIXED-IN: 4.11
REVIEW: 107936
parent 4f20960b
......@@ -576,6 +576,36 @@ void AuroraeClient::slotAlphaChanged()
}
}
QRegion AuroraeClient::region(KDecorationDefines::Region r)
{
if (r != ExtendedBorderRegion) {
return QRegion();
}
if (!m_item) {
return QRegion();
}
if (isMaximized()) {
// empty region for maximized windows
return QRegion();
}
const int top = m_item->property("extendedBorderTop").toInt();
const int right = m_item->property("extendedBorderRight").toInt();
const int bottom = m_item->property("extendedBorderBottom").toInt();
const int left = m_item->property("extendedBorderLeft").toInt();
if (top == 0 && right == 0 && bottom == 0 && left == 0) {
// no extended borders
return QRegion();
}
int paddingLeft, paddingRight, paddingTop, paddingBottom;
paddingLeft = paddingRight = paddingTop = paddingBottom = 0;
padding(paddingLeft, paddingRight, paddingTop, paddingBottom);
QRect rect = widget()->rect().adjusted(paddingLeft, paddingTop, -paddingRight, -paddingBottom);
rect.translate(-paddingLeft, -paddingTop);
return QRegion(rect.adjusted(-left, -bottom, right, top)).subtract(rect);
}
} // namespace Aurorae
extern "C"
......
......@@ -166,6 +166,8 @@ public slots:
void titlebarDblClickOperation();
void maximize(int button);
QRegion region(KDecorationDefines::Region r);
private slots:
void themeChanged();
void doCloseWindow();
......
......@@ -31,6 +31,10 @@ Item {
property int borderRightMaximized
property int borderTopMaximized
property int borderBottomMaximized
property int extendedBorderTop : 0
property int extendedBorderRight : 0
property int extendedBorderBottom : 0
property int extendedBorderLeft : 0
property bool alpha: true
onAlphaChanged: alphaChanged()
......
......@@ -19,29 +19,48 @@ import org.kde.kwin.decoration 0.1
import org.kde.kwin.decorations.plastik 1.0
Decoration {
function enableExtendedBorders() {
root.extendedBorderTop = 0;
root.extendedBorderRight = 3;
root.extendedBorderBottom = 3;
root.extendedBorderLeft = 3;
}
function disableExtendedBorders() {
root.extendedBorderTop = 0;
root.extendedBorderRight = 0;
root.extendedBorderBottom = 0;
root.extendedBorderLeft = 0;
}
function readConfig() {
switch (decoration.readConfig("BorderSize", DecorationOptions.BorderNormal)) {
case DecorationOptions.BorderTiny:
root.borderSize = 3;
enableExtendedBorders();
break;
case DecorationOptions.BorderLarge:
root.borderSize = 8;
disableExtendedBorders();
break;
case DecorationOptions.BorderVeryLarge:
root.borderSize = 12;
disableExtendedBorders();
break;
case DecorationOptions.BorderHuge:
root.borderSize = 18;
disableExtendedBorders();
break;
case DecorationOptions.BorderVeryHuge:
root.borderSize = 27;
disableExtendedBorders();
break;
case DecorationOptions.BorderOversized:
root.borderSize = 40;
disableExtendedBorders();
break;
case DecorationOptions.BorderNormal: // fall through to default
default:
root.borderSize = 4;
disableExtendedBorders();
break;
}
var titleAlignLeft = decoration.readConfig("titleAlignLeft", true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment