diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2017-10-13 12:10:25 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2017-10-16 07:57:18 +0000 |
commit | 2aad31a8be87933baedbd2a251a210903ddcb013 (patch) | |
tree | 09bc49b3b68bd59201cb04300181e4f6d4498f8d /examples/wayland/minimal-qml | |
parent | 187fd96f35fa212dfce4c2bf3c417096ca33c8f1 (diff) | |
download | qtwayland-2aad31a8be87933baedbd2a251a210903ddcb013.tar.gz |
Update minimal-qml example
Use xdg-shell-v6 instead of v5 and use a ListModel instead of
instantiating ShellSurfaceItems explicitly.
Change-Id: Ia9e8620ff0beed19fa1401a535311a2d78797368
Reviewed-by: David Edmundson <davidedmundson@kde.org>
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'examples/wayland/minimal-qml')
-rw-r--r-- | examples/wayland/minimal-qml/main.qml | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml index 44920ae7..693ea5c8 100644 --- a/examples/wayland/minimal-qml/main.qml +++ b/examples/wayland/minimal-qml/main.qml @@ -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: toplevel}); } + ListModel { id: shellSurfaces } } |