shift-shell/compositor/ClientWindowWrapper.qml
Pier Luigi Fiorini ac4f1a714f Install the compositor as a Green Island plugin
Green Island removed the KPackage dependency because it didn't add too
much value to justify it. QStandardPaths is enough to find plugins.

This patch installs the compositor into DATA_INSTALL_DIR/greenisland.
2015-01-13 09:32:39 +01:00

75 lines
2.2 KiB
QML

/*
* Copyright 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
WindowWrapper {
id: window
objectName: "clientWindow"
onXChanged: {
if (compositorRoot.currentWindow == window) {
compositorRoot.layers.windows.contentX = x;
}
}
Behavior on y {
enabled: !mouse.active
SequentialAnimation {
NumberAnimation {
easing.type: "InOutQuad"
duration: units.longDuration
}
ScriptAction {
script: {
if (window.opacity < 0.3) {
window.close();
}
}
}
}
}
opacity: 1 - (Math.abs(y) / height)
MouseArea {
id: mouse
z: 99
anchors.fill: parent
enabled: compositorRoot.layers.windows.switchMode
property bool active
onPressed: {
active = true;
}
onClicked: {
compositorRoot.currentWindow = window;
window.child.takeFocus();
}
onReleased: {
active = false;
if (window.opacity < 0.3) {
window.y = (window.y > 0 ? +1 : -1) * window.height;
} else {
window.y = 0;
}
}
drag {
axis: Drag.YAxis
target: window
}
}
}