summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Gräßlin <mgraesslin@kde.org>2012-12-27 07:51:15 (GMT)
committerMartin Gräßlin <mgraesslin@kde.org>2012-12-30 08:54:43 (GMT)
commitfb862b7ec9e3ba1e25c69322d4e02ceeaec698ee (patch)
treef40d96ff378872cc1d420bff64c1880e2b49c8c3
parent4f20960bfedbf2f6aac081c180bc605e79d55cc5 (diff)
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
-rw-r--r--kwin/clients/aurorae/src/aurorae.cpp30
-rw-r--r--kwin/clients/aurorae/src/aurorae.h2
-rw-r--r--kwin/clients/aurorae/src/qml/Decoration.qml4
-rw-r--r--kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml19
4 files changed, 55 insertions, 0 deletions
diff --git a/kwin/clients/aurorae/src/aurorae.cpp b/kwin/clients/aurorae/src/aurorae.cpp
index b6c219b..50e4c54 100644
--- a/kwin/clients/aurorae/src/aurorae.cpp
+++ b/kwin/clients/aurorae/src/aurorae.cpp
@@ -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"
diff --git a/kwin/clients/aurorae/src/aurorae.h b/kwin/clients/aurorae/src/aurorae.h
index 6e187ea..44c6007 100644
--- a/kwin/clients/aurorae/src/aurorae.h
+++ b/kwin/clients/aurorae/src/aurorae.h
@@ -166,6 +166,8 @@ public slots:
void titlebarDblClickOperation();
void maximize(int button);
+ QRegion region(KDecorationDefines::Region r);
+
private slots:
void themeChanged();
void doCloseWindow();
diff --git a/kwin/clients/aurorae/src/qml/Decoration.qml b/kwin/clients/aurorae/src/qml/Decoration.qml
index b885278..15c7769 100644
--- a/kwin/clients/aurorae/src/qml/Decoration.qml
+++ b/kwin/clients/aurorae/src/qml/Decoration.qml
@@ -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()
diff --git a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml
index d18d7a7..c6b3042 100644
--- a/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml
+++ b/kwin/clients/aurorae/themes/plastik/package/contents/ui/main.qml
@@ -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);