summaryrefslogtreecommitdiffstats
path: root/examples/wayland/minimal-qml/main.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/wayland/minimal-qml/main.qml')
-rw-r--r--examples/wayland/minimal-qml/main.qml37
1 files changed, 18 insertions, 19 deletions
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml
index 44920ae73..0f0ca61bc 100644
--- a/examples/wayland/minimal-qml/main.qml
+++ b/examples/wayland/minimal-qml/main.qml
@@ -50,7 +50,7 @@
import QtQuick 2.6
import QtQuick.Window 2.2
-import QtWayland.Compositor 1.0
+import QtWayland.Compositor 1.1
WaylandCompositor {
// The output defines the screen.
@@ -60,32 +60,31 @@ WaylandCompositor {
width: 1024
height: 768
visible: true
- Rectangle {
- id: surfaceArea
- color: "#1337af"
- anchors.fill: parent
+ Repeater {
+ model: shellSurfaces
+ // ShellSurfaceItem handles displaying a shell surface.
+ // It has implementations for things like interactive
+ // resize/move, and forwarding of mouse and keyboard
+ // events to the client process.
+ ShellSurfaceItem {
+ shellSurface: modelData
+ onSurfaceDestroyed: shellSurfaces.remove(index)
+ }
}
}
}
- // The chrome defines the window look and behavior.
- // Here we use the built-in ShellSurfaceItem.
- Component {
- id: chromeComponent
- ShellSurfaceItem {
- onSurfaceDestroyed: destroy()
- }
- }
// Extensions are additions to the core Wayland
// protocol. We choose to support two different
// shells (window management protocols). When the
- // client creates a new window, we instantiate a
- // chromeComponent on the output.
+ // client creates a new shell surface (i.e. a window)
+ // we append it to our list of shellSurfaces.
WlShell {
onWlShellSurfaceCreated:
- chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
+ shellSurfaces.append({shellSurface: shellSurface});
}
- XdgShellV5 {
- onXdgSurfaceCreated:
- chromeComponent.createObject(surfaceArea, { "shellSurface": xdgSurface } );
+ XdgShellV6 {
+ onToplevelCreated:
+ shellSurfaces.append({shellSurface: xdgSurface});
}
+ ListModel { id: shellSurfaces }
}