From 992cde48d72435052514845b8add8d0dc880ccb2 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 7 Aug 2018 13:53:34 +0200 Subject: Compositor API: Add xdg-shell stable [ChangeLog][Compositor API] Added APIs for xdg-shell stable. Code copied from the V6 implementation with suffixes and prefixes removed. Otherwise a few minor edits, such as renaming xdg_shell to xdg_wm_base, and handling the anchor and gravity edges no longer being bitfields. Examples that used v6 have been updated to use stable instead, or, in some cases, to support both. Task-number: QTBUG-66784 Change-Id: Ia619b478a938fdcd9b47af8a8df2d7fcc4406204 Reviewed-by: Paul Olav Tvete --- examples/wayland/hwlayer-compositor/main.qml | 5 +++-- examples/wayland/minimal-qml/main.qml | 8 ++++++-- examples/wayland/multi-screen/qml/main.qml | 6 +++++- examples/wayland/overview-compositor/main.qml | 4 ++-- examples/wayland/pure-qml/qml/main.qml | 7 ++++++- examples/wayland/spanning-screens/main.qml | 4 ++-- 6 files changed, 24 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/wayland/hwlayer-compositor/main.qml b/examples/wayland/hwlayer-compositor/main.qml index 2f6a5f0d..b4f088c9 100644 --- a/examples/wayland/hwlayer-compositor/main.qml +++ b/examples/wayland/hwlayer-compositor/main.qml @@ -51,7 +51,7 @@ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Controls 2.2 -import QtWayland.Compositor 1.2 +import QtWayland.Compositor 1.3 WaylandCompositor { WaylandOutput { @@ -155,6 +155,7 @@ WaylandCompositor { function addShellSurface(shellSurface) { shellSurfaces.append({shSurface: shellSurface, animatePosition: false, animateOpacity: false, level: 0}); } - WlShell { onWlShellSurfaceCreated: addShellSurface(shellSurface) } + XdgShell { onToplevelCreated: addShellSurface(xdgSurface) } XdgShellV6 { onToplevelCreated: addShellSurface(xdgSurface) } + WlShell { onWlShellSurfaceCreated: addShellSurface(shellSurface) } } diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml index 85c8c578..63ed9da5 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.1 +import QtWayland.Compositor 1.3 WaylandCompositor { // The output defines the screen. @@ -75,7 +75,7 @@ WaylandCompositor { } } // Extensions are additions to the core Wayland - // protocol. We choose to support two different + // protocol. We choose to support three different // shells (window management protocols). When the // client creates a new shell surface (i.e. a window) // we append it to our list of shellSurfaces. @@ -87,5 +87,9 @@ WaylandCompositor { onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface}); } + XdgShell { + onToplevelCreated: + shellSurfaces.append({shellSurface: xdgSurface}); + } ListModel { id: shellSurfaces } } diff --git a/examples/wayland/multi-screen/qml/main.qml b/examples/wayland/multi-screen/qml/main.qml index 354dd1c9..ecd32739 100644 --- a/examples/wayland/multi-screen/qml/main.qml +++ b/examples/wayland/multi-screen/qml/main.qml @@ -52,7 +52,7 @@ import QtQml 2.2 import QtQuick 2.0 import QtQuick.Window 2.3 as Window -import QtWayland.Compositor 1.1 +import QtWayland.Compositor 1.3 import QtQml.Models 2.1 WaylandCompositor { @@ -104,6 +104,10 @@ WaylandCompositor { onToplevelCreated: handleShellSurfaceCreated(xdgSurface) } + XdgShell { + onToplevelCreated: handleShellSurfaceCreated(xdgSurface) + } + function createShellSurfaceItem(shellSurface, moveItem, output) { var parentSurfaceItem = output.viewsBySurface[shellSurface.parentSurface]; var parent = parentSurfaceItem || output.surfaceArea; diff --git a/examples/wayland/overview-compositor/main.qml b/examples/wayland/overview-compositor/main.qml index 18589e50..d0482a90 100644 --- a/examples/wayland/overview-compositor/main.qml +++ b/examples/wayland/overview-compositor/main.qml @@ -49,7 +49,7 @@ ****************************************************************************/ import QtQuick 2.7 -import QtWayland.Compositor 1.1 +import QtWayland.Compositor 1.3 import QtQuick.Window 2.3 import QtQuick.Controls 2.0 @@ -132,7 +132,7 @@ WaylandCompositor { ListModel { id: toplevels } - XdgShellV6 { + XdgShell { onToplevelCreated: { toplevels.append({xdgSurface}); toplevel.sendFullscreen(Qt.size(win.pixelWidth, win.pixelHeight)); diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml index b188ebbb..69be7cf1 100644 --- a/examples/wayland/pure-qml/qml/main.qml +++ b/examples/wayland/pure-qml/qml/main.qml @@ -49,7 +49,7 @@ ****************************************************************************/ import QtQuick 2.0 -import QtWayland.Compositor 1.1 +import QtWayland.Compositor 1.3 WaylandCompositor { id: waylandCompositor @@ -58,6 +58,11 @@ WaylandCompositor { // Shell surface extension. Needed to provide a window concept for Wayland clients. // I.e. requests and events for maximization, minimization, resizing, closing etc. + XdgShell { + onToplevelCreated: screen.handleShellSurface(xdgSurface) + } + + // Unstable version of xdg-shell still used by some clients XdgShellV6 { onToplevelCreated: screen.handleShellSurface(xdgSurface) } diff --git a/examples/wayland/spanning-screens/main.qml b/examples/wayland/spanning-screens/main.qml index a3230806..ab57306b 100644 --- a/examples/wayland/spanning-screens/main.qml +++ b/examples/wayland/spanning-screens/main.qml @@ -50,7 +50,7 @@ import QtQuick 2.6 import QtQuick.Window 2.3 -import QtWayland.Compositor 1.1 +import QtWayland.Compositor 1.3 WaylandCompositor { WaylandOutput { @@ -105,7 +105,7 @@ WaylandCompositor { } } - XdgShellV6 { + XdgShell { onToplevelCreated: { const shellSurface = xdgSurface; -- cgit v1.2.1