blob: 9d6648fe9778e758d59bd8b05fc39e38f09e3893 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
// Copyright (C) 2018 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Window
import QtQuick.Controls 2.2
import QtWayland.Compositor
import QtWayland.Compositor.XdgShell
import QtWayland.Compositor.WlShell
import QtWayland.Compositor.IviApplication
WaylandCompositor {
WaylandOutput {
sizeFollowsWindow: true
window: Window {
color: "tomato"
id: win
width: 1024
height: 768
visible: true
Rectangle {
color: "lightgreen"
anchors.centerIn: parent
width: parent.width / 3
height: parent.width / 3
NumberAnimation on rotation {
id: rotationAnimation
running: false
from: 0
to: 90
loops: Animation.Infinite
duration: 1000
}
}
Repeater {
model: shellSurfaces
ShellSurfaceItem {
id: waylandItem
onSurfaceDestroyed: shellSurfaces.remove(index)
shellSurface: shSurface
WaylandHardwareLayer {
stackingLevel: level
Component.onCompleted: console.log("Added hardware layer with stacking level", stackingLevel);
}
Component.onCompleted: console.log("Added wayland quick item");
Behavior on x {
PropertyAnimation {
easing.type: Easing.OutBounce
duration: 1000
}
}
Timer {
interval: 2000; running: animatePosition; repeat: true
onTriggered: waylandItem.x = waylandItem.x === 0 ? win.width - waylandItem.width : 0
}
Behavior on opacity {
PropertyAnimation {
duration: 1000
}
}
Timer {
interval: 2000; running: animateOpacity; repeat: true
onTriggered: waylandItem.opacity = waylandItem.opacity === 1 ? 0 : 1
}
}
}
Column {
anchors.bottom: parent.bottom
Repeater {
model: shellSurfaces
Row {
Label {
anchors.verticalCenter: parent.verticalCenter
leftPadding: 15
rightPadding: 15
text: "Surface " + index
}
CheckBox {
text: "Animate position"
checked: animatePosition
onClicked: animatePosition = !animatePosition
}
CheckBox {
text: "Animate Opacity"
checked: animateOpacity
onClicked: animateOpacity = !animateOpacity
}
Label {
text: "Stacking level"
}
SpinBox {
value: level
onValueModified: level = value;
}
Button {
text: "Kill"
onClicked: shSurface.surface.client.close()
}
}
}
CheckBox {
text: "Rotation"
checked: rotationAnimation.running
onClicked: rotationAnimation.running = !rotationAnimation.running
padding: 30
}
}
}
}
ListModel { id: shellSurfaces }
function addShellSurface(shellSurface) {
shellSurfaces.append({shSurface: shellSurface, animatePosition: false, animateOpacity: false, level: 0});
}
XdgShell { onToplevelCreated: addShellSurface(xdgSurface) }
IviApplication { onIviSurfaceCreated: addShellSurface(iviSurface) }
WlShell { onWlShellSurfaceCreated: addShellSurface(shellSurface) }
}
|