From 458dfb4c65dd959115416a5bc9d6dfc5e4936bd6 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 6 Apr 2017 10:57:37 +0200 Subject: Compositor: Automatically create ShellSurfaceItems for popups Change-Id: I5e6b0147c4f1bb73ff3a8f5512d21884f962a89a Reviewed-by: Paul Olav Tvete --- examples/wayland/minimal-qml/main.qml | 1 + examples/wayland/pure-qml/qml/Chrome.qml | 1 + examples/wayland/pure-qml/qml/main.qml | 18 ++---------------- 3 files changed, 4 insertions(+), 16 deletions(-) (limited to 'examples/wayland') diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml index 0f0ca61bc..85c8c5783 100644 --- a/examples/wayland/minimal-qml/main.qml +++ b/examples/wayland/minimal-qml/main.qml @@ -67,6 +67,7 @@ WaylandCompositor { // resize/move, and forwarding of mouse and keyboard // events to the client process. ShellSurfaceItem { + autoCreatePopupItems: true shellSurface: modelData onSurfaceDestroyed: shellSurfaces.remove(index) } diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml index e6fe97476..2e2586c1b 100644 --- a/examples/wayland/pure-qml/qml/Chrome.qml +++ b/examples/wayland/pure-qml/qml/Chrome.qml @@ -53,6 +53,7 @@ import QtWayland.Compositor 1.0 ShellSurfaceItem { id: rootChrome + autoCreatePopupItems: true property bool isChild: parent.shellSurface !== undefined diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index 77ed3ecd9..7bf2a623c 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -83,29 +83,15 @@ WaylandCompositor { } } - property variant viewsBySurface: ({}) - XdgShellV5 { onXdgSurfaceCreated: { - var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } ); - viewsBySurface[xdgSurface.surface] = item; - } - onXdgPopupCreated: { - var parentView = viewsBySurface[xdgPopup.parentSurface]; - var item = chromeComponent.createObject(parentView, { "shellSurface": xdgPopup } ); - viewsBySurface[xdgPopup.surface] = item; + chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } ); } } XdgShellV6 { onToplevelCreated: { - var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } ); - viewsBySurface[xdgSurface.surface] = item; - } - onPopupCreated: { - var parentView = viewsBySurface[popup.parentXdgSurface.surface]; - var item = chromeComponent.createObject(parentView, { "shellSurface": xdgSurface } ); - viewsBySurface[xdgSurface.surface] = item; + chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } ); } } -- cgit v1.2.3