From 2aad31a8be87933baedbd2a251a210903ddcb013 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Fri, 13 Oct 2017 12:10:25 +0200 Subject: 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 Reviewed-by: Pier Luigi Fiorini --- examples/wayland/minimal-qml/main.qml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'examples/wayland/minimal-qml') diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml index 44920ae73..693ea5c81 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 } } -- cgit v1.2.3