Commit ee7597de authored by Pier Luigi Fiorini's avatar Pier Luigi Fiorini

Add button to close application windows

parent 5c916daa
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
import QtQuick 2.0 import QtQuick 2.0
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import "WindowManagement.js" as WindowManagement import "WindowManagement.js" as WindowManagement
...@@ -27,6 +28,7 @@ Rectangle { ...@@ -27,6 +28,7 @@ Rectangle {
readonly property alias layers: layers readonly property alias layers: layers
readonly property real topBarHeight: units.iconSizes.small readonly property real topBarHeight: units.iconSizes.small
readonly property real bottomBarHeight: units.iconSizes.medium readonly property real bottomBarHeight: units.iconSizes.medium
property var currentWindow: null
id: compositorRoot id: compositorRoot
color: "black" color: "black"
...@@ -89,16 +91,40 @@ Rectangle { ...@@ -89,16 +91,40 @@ Rectangle {
} }
} }
PlasmaCore.IconItem { ColumnLayout {
anchors.centerIn: parent anchors.fill: parent
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
width: units.iconSizes.smallMedium
height: width
source: "go-home"
MouseArea { PlasmaCore.IconItem {
anchors.fill: parent colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
onClicked: showHome = true width: units.iconSizes.smallMedium
height: width
source: "window-close"
Layout.alignment: Qt.AlignHCenter
MouseArea {
anchors.fill: parent
onClicked: {
if (currentWindow) {
currentWindow.close();
currentWindow = null;
}
}
}
}
PlasmaCore.IconItem {
colorGroup: PlasmaCore.Theme.ComplementaryColorGroup
width: units.iconSizes.smallMedium
height: width
source: "go-home"
Layout.alignment: Qt.AlignHCenter
MouseArea {
anchors.fill: parent
onClicked: showHome = true
}
} }
} }
} }
......
...@@ -131,6 +131,7 @@ function mapApplicationSurface(surface) { ...@@ -131,6 +131,7 @@ function mapApplicationSurface(surface) {
// Switch to the applications layer and take focus // Switch to the applications layer and take focus
compositorRoot.showHome = false; compositorRoot.showHome = false;
compositorRoot.currentWindow = window;
window.child.takeFocus(); window.child.takeFocus();
// Run map animation // Run map animation
...@@ -160,6 +161,7 @@ function mapShellSurface(surface, child) { ...@@ -160,6 +161,7 @@ function mapShellSurface(surface, child) {
// Switch to the desktop layer and take focus // Switch to the desktop layer and take focus
compositorRoot.showHome = true; compositorRoot.showHome = true;
compositorRoot.currentWindow = null;
entry.window.child.takeFocus(); entry.window.child.takeFocus();
return; return;
...@@ -202,6 +204,7 @@ function mapShellSurface(surface, child) { ...@@ -202,6 +204,7 @@ function mapShellSurface(surface, child) {
function unmapApplicationSurface(surface) { function unmapApplicationSurface(surface) {
// Reactivate home layer as soon as an application window is unmapped // Reactivate home layer as soon as an application window is unmapped
compositorRoot.showHome = true; compositorRoot.showHome = true;
compositorRoot.currentWindow = null;
} }
function unmapShellSurface(surface) { function unmapShellSurface(surface) {
......
...@@ -37,4 +37,11 @@ Item { ...@@ -37,4 +37,11 @@ Item {
anchors.fill: parent anchors.fill: parent
source: child source: child
} }
function close() {
if (!child || !child.surface)
return;
child.surface.client.close();
}
} }
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