summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernd Weimer <bernd.weimer@qt.io>2022-11-22 16:49:13 +0100
committerBernd Weimer <bernd.weimer@qt.io>2022-11-25 08:49:56 +0100
commitdd5f398ea2cd66dccba1582cd910e398e8f66029 (patch)
tree26f7bd9148895f9c7f9c0da5a06299580ff2aa78
parentc14916f5fd84f6b5483024b3df77592661a0f04e (diff)
Improve examples
Updated signal handlers to new syntax to reduce noise (warnings). Allowed to build examples with subfolders in one step, updated from deprecated WlShell to XdgShell, etc. Change-Id: If821363ffd1b38ea1d152f5a044b0609cf739014 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--examples/wayland/CMakeLists.txt6
-rw-r--r--examples/wayland/custom-extension/CMakeLists.txt9
-rw-r--r--examples/wayland/custom-extension/client-common/customextension.cpp5
-rw-r--r--examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml11
-rw-r--r--examples/wayland/custom-extension/compositor/qml/main.qml52
-rw-r--r--examples/wayland/custom-extension/qml-client/main.qml9
-rw-r--r--examples/wayland/custom-shell/CMakeLists.txt7
-rw-r--r--examples/wayland/hwlayer-compositor/main.qml66
-rw-r--r--examples/wayland/ivi-compositor/main.qml5
-rw-r--r--examples/wayland/minimal-qml/main.qml10
-rw-r--r--examples/wayland/multi-output/qml/ShellScreen.qml2
-rw-r--r--examples/wayland/multi-output/qml/main.qml5
-rw-r--r--examples/wayland/multi-screen/doc/src/multi-screen.qdoc2
-rw-r--r--examples/wayland/multi-screen/qml/CompositorScreen.qml2
-rw-r--r--examples/wayland/multi-screen/qml/main.qml5
-rw-r--r--examples/wayland/overview-compositor/main.qml2
-rw-r--r--examples/wayland/pure-qml/qml/main.qml6
-rw-r--r--examples/wayland/qtshell/qml/main.qml2
-rw-r--r--examples/wayland/server-buffer/CMakeLists.txt7
-rw-r--r--examples/wayland/server-buffer/compositor/qml/main.qml5
-rw-r--r--examples/wayland/server-side-decoration/main.qml2
-rw-r--r--examples/wayland/spanning-screens/main.qml2
-rw-r--r--src/compositor/qmlfiles/WaylandCursorItem.qml6
23 files changed, 124 insertions, 104 deletions
diff --git a/examples/wayland/CMakeLists.txt b/examples/wayland/CMakeLists.txt
index f8e31c7c0..2783d7a9c 100644
--- a/examples/wayland/CMakeLists.txt
+++ b/examples/wayland/CMakeLists.txt
@@ -18,10 +18,10 @@ if(TARGET Qt::Quick)
qt_internal_add_example(qtshell)
endif()
if(TARGET Qt::Quick AND TARGET Qt::WaylandClient)
- add_subdirectory(custom-extension)
- add_subdirectory(custom-shell)
+ qt_internal_add_example(custom-extension)
+ qt_internal_add_example(custom-shell)
endif()
if(QT_FEATURE_opengl AND TARGET Qt::Quick AND TARGET Qt::WaylandClient)
- add_subdirectory(server-buffer)
+ qt_internal_add_example(server-buffer)
endif()
endif()
diff --git a/examples/wayland/custom-extension/CMakeLists.txt b/examples/wayland/custom-extension/CMakeLists.txt
index 0462836e8..073c7ca4b 100644
--- a/examples/wayland/custom-extension/CMakeLists.txt
+++ b/examples/wayland/custom-extension/CMakeLists.txt
@@ -1,6 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: BSD-3-Clause
-qt_internal_add_example(qml-client)
-qt_internal_add_example(compositor)
-qt_internal_add_example(cpp-client)
+cmake_minimum_required(VERSION 3.16)
+project(custom-extension)
+
+add_subdirectory(qml-client)
+add_subdirectory(compositor)
+add_subdirectory(cpp-client)
diff --git a/examples/wayland/custom-extension/client-common/customextension.cpp b/examples/wayland/custom-extension/client-common/customextension.cpp
index 73fea01b1..3c585af3a 100644
--- a/examples/wayland/custom-extension/client-common/customextension.cpp
+++ b/examples/wayland/custom-extension/client-common/customextension.cpp
@@ -56,8 +56,10 @@ void CustomExtension::sendWindowRegistration(QWindow *window)
void CustomExtension::registerWindow(QWindow *window)
{
m_windows << window;
- if (isActive())
+ if (isActive()) {
+ m_activated = true;
sendWindowRegistration(window);
+ }
}
CustomExtensionObject *CustomExtension::createCustomObject(const QString &color, const QString &text)
@@ -79,6 +81,7 @@ void CustomExtension::sendSpin(QWindow *window, uint ms)
void CustomExtension::handleExtensionActive()
{
if (isActive() && !m_activated) {
+ m_activated = true;
for (QWindow *w : std::as_const(m_windows))
sendWindowRegistration(w);
}
diff --git a/examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml b/examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml
index 724c0975a..ec70a4373 100644
--- a/examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml
+++ b/examples/wayland/custom-extension/compositor/qml/CompositorScreen.qml
@@ -20,7 +20,7 @@ WaylandOutput {
Rectangle {
id: sidebar
- width: 150
+ width: 250
anchors.left: parent.left
anchors.top: parent.top
anchors.bottom: parent.bottom
@@ -34,19 +34,20 @@ WaylandOutput {
Repeater {
model: comp.itemList
Rectangle {
- height: 36
+ height: 54
width: sidebar.width - 5
color: "white"
radius: 5
Text {
- text: "window: " + modelData.shellSurface.title + "[" + modelData.shellSurface.className
- + (modelData.isCustom ? "]\nfont size: " + modelData.fontSize :"]\n No extension")
+ text: "window: " + modelData.shellSurface.toplevel.title + "\n["
+ + modelData.shellSurface.toplevel.appId
+ + (modelData.isCustom ? "]\nfont size: " + modelData.fontSize : "]\nNo extension")
color: modelData.isCustom ? "black" : "darkgray"
}
MouseArea {
enabled: modelData.isCustom
anchors.fill: parent
- onWheel: {
+ onWheel: (wheel) => {
if (wheel.angleDelta.y > 0)
modelData.fontSize++
else if (wheel.angleDelta.y < 0 && modelData.fontSize > 3)
diff --git a/examples/wayland/custom-extension/compositor/qml/main.qml b/examples/wayland/custom-extension/compositor/qml/main.qml
index d9b57e7cf..7005af841 100644
--- a/examples/wayland/custom-extension/compositor/qml/main.qml
+++ b/examples/wayland/custom-extension/compositor/qml/main.qml
@@ -3,7 +3,7 @@
import QtQuick
import QtWayland.Compositor
-import QtWayland.Compositor.WlShell
+import QtWayland.Compositor.XdgShell
import io.qt.examples.customextension 1.0
@@ -34,36 +34,38 @@ WaylandCompositor {
property int fontSize: 12
onSurfaceDestroyed: {
- var index = itemList.indexOf(chrome);
+ var index = itemList.indexOf(chrome)
if (index > -1) {
var listCopy = itemList
- listCopy.splice(index, 1);
+ listCopy.splice(index, 1)
itemList = listCopy
}
chrome.destroy()
}
+
transform: [
Rotation {
id: xRot
- origin.x: chrome.width/2; origin.y: chrome.height/2;
+ origin.x: chrome.width / 2; origin.y: chrome.height / 2
angle: 0
axis { x: 1; y: 0; z: 0 }
},
Rotation {
id: yRot
- origin.x: chrome.width/2; origin.y: chrome.height/2;
+ origin.x: chrome.width / 2; origin.y: chrome.height / 2
angle: 0
axis { x: 0; y: 1; z: 0 }
}
]
+
NumberAnimation {
id: spinAnimation
running: false
loops: 2
- target: yRot;
- property: "angle";
- from: 0; to: 360;
- duration: 400;
+ target: yRot
+ property: "angle"
+ from: 0; to: 360
+ duration: 400
}
function doSpin(ms) {
@@ -82,11 +84,13 @@ WaylandCompositor {
easing.type: Easing.OutBounce
duration: 1000
}
+
function doBounce(ms) {
console.log("bounce " + ms)
// using the 'ms' argument is left as an exercise for the reader...
bounceAnimation.start()
}
+
onFontSizeChanged: {
custom.setFontSize(surface, fontSize)
}
@@ -120,22 +124,21 @@ WaylandCompositor {
Connections {
target: obj
- onResourceDestroyed: {
+ function onResourceDestroyed() {
customItem.destroy()
}
}
}
}
- WlShell {
- id: defaultShell
- onWlShellSurfaceCreated: {
- var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": shellSurface } );
- var w = defaultOutput.surfaceArea.width/2
- var h = defaultOutput.surfaceArea.height/2
- item.x = Math.random()*w
- item.y = Math.random()*h
- var listCopy = itemList // List properties cannot be modified through Javascript operations
+ XdgShell {
+ onToplevelCreated: (toplevel, xdgSurface) => {
+ var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } )
+ var w = defaultOutput.surfaceArea.width / 2
+ var h = defaultOutput.surfaceArea.height / 2
+ item.x = Math.random() * w
+ item.y = Math.random() * h
+ var listCopy = itemList; // List properties cannot be modified through Javascript operations
listCopy.push(item)
itemList = listCopy
}
@@ -144,20 +147,21 @@ WaylandCompositor {
CustomExtension {
id: custom
- onSurfaceAdded: {
+ onSurfaceAdded: (surface) => {
var item = itemForSurface(surface)
item.isCustom = true
}
- onBounce: {
+ onBounce: (surface, ms) => {
var item = itemForSurface(surface)
item.doBounce(ms)
}
- onSpin: {
+ onSpin: (surface, ms) => {
var item = itemForSurface(surface)
item.doSpin(ms)
}
- onCustomObjectCreated: {
- var item = customObjectComponent.createObject(defaultOutput.surfaceArea, { "color": obj.color, "text": obj.text, "obj": obj } );
+ onCustomObjectCreated: (obj) => {
+ var item = customObjectComponent.createObject(defaultOutput.surfaceArea,
+ { "color": obj.color, "text": obj.text, "obj": obj } )
}
}
diff --git a/examples/wayland/custom-extension/qml-client/main.qml b/examples/wayland/custom-extension/qml-client/main.qml
index 3b0515781..6ceefda2f 100644
--- a/examples/wayland/custom-extension/qml-client/main.qml
+++ b/examples/wayland/custom-extension/qml-client/main.qml
@@ -7,12 +7,17 @@ import io.qt.examples.customextension
Window {
id: topLevelWindow
+
+ property alias textItem: bounceText
+
+ title: "QML Client"
visible: true
+
Rectangle {
anchors.fill: parent
color: "#f1eece"
}
- property alias textItem: bounceText
+
Text {
id: bounceText
text: "press here to bounce"
@@ -49,7 +54,7 @@ Window {
console.log("Custom extension is active:", active)
registerWindow(topLevelWindow)
}
- onFontSize: {
+ onFontSize: (window, pixelSize) => {
// signal arguments: window and pixelSize
// we are free to interpret the protocol as we want, so
// let's change the font size of just one of the text items
diff --git a/examples/wayland/custom-shell/CMakeLists.txt b/examples/wayland/custom-shell/CMakeLists.txt
index 7158582ec..1b0fe1653 100644
--- a/examples/wayland/custom-shell/CMakeLists.txt
+++ b/examples/wayland/custom-shell/CMakeLists.txt
@@ -1,2 +1,5 @@
-qt_internal_add_example(client-plugin)
-qt_internal_add_example(compositor)
+cmake_minimum_required(VERSION 3.16)
+project(custom-shell)
+
+add_subdirectory(client-plugin)
+add_subdirectory(compositor)
diff --git a/examples/wayland/hwlayer-compositor/main.qml b/examples/wayland/hwlayer-compositor/main.qml
index 9d6648fe9..569f46348 100644
--- a/examples/wayland/hwlayer-compositor/main.qml
+++ b/examples/wayland/hwlayer-compositor/main.qml
@@ -3,7 +3,7 @@
import QtQuick
import QtQuick.Window
-import QtQuick.Controls 2.2
+import QtQuick.Controls
import QtWayland.Compositor
import QtWayland.Compositor.XdgShell
import QtWayland.Compositor.WlShell
@@ -32,37 +32,37 @@ WaylandCompositor {
duration: 1000
}
}
- Repeater {
- model: shellSurfaces
- ShellSurfaceItem {
- id: waylandItem
- onSurfaceDestroyed: shellSurfaces.remove(index)
- shellSurface: shSurface
- WaylandHardwareLayer {
- stackingLevel: level
- Component.onCompleted: console.log("Added hardware layer with stacking level", stackingLevel);
- }
- Component.onCompleted: console.log("Added wayland quick item");
- Behavior on x {
- PropertyAnimation {
- easing.type: Easing.OutBounce
- duration: 1000
- }
- }
- Timer {
- interval: 2000; running: animatePosition; repeat: true
- onTriggered: waylandItem.x = waylandItem.x === 0 ? win.width - waylandItem.width : 0
- }
- Behavior on opacity {
- PropertyAnimation {
- duration: 1000
- }
+ Repeater {
+ model: shellSurfaces
+ ShellSurfaceItem {
+ id: waylandItem
+ onSurfaceDestroyed: shellSurfaces.remove(index)
+ shellSurface: shSurface
+ WaylandHardwareLayer {
+ stackingLevel: level
+ Component.onCompleted: console.log("Added hardware layer with stacking level", stackingLevel);
+ }
+ Component.onCompleted: console.log("Added wayland quick item");
+ Behavior on x {
+ PropertyAnimation {
+ easing.type: Easing.OutBounce
+ duration: 1000
}
- Timer {
- interval: 2000; running: animateOpacity; repeat: true
- onTriggered: waylandItem.opacity = waylandItem.opacity === 1 ? 0 : 1
+ }
+ Timer {
+ interval: 2000; running: animatePosition; repeat: true
+ onTriggered: waylandItem.x = waylandItem.x === 0 ? win.width - waylandItem.width : 0
+ }
+ Behavior on opacity {
+ PropertyAnimation {
+ duration: 1000
}
}
+ Timer {
+ interval: 2000; running: animateOpacity; repeat: true
+ onTriggered: waylandItem.opacity = waylandItem.opacity === 1 ? 0 : 1
+ }
+ }
}
Column {
anchors.bottom: parent.bottom
@@ -94,7 +94,7 @@ WaylandCompositor {
}
Button {
text: "Kill"
- onClicked: shSurface.surface.client.close()
+ onClicked: shSurface.surface.client.kill()
}
}
}
@@ -111,7 +111,7 @@ WaylandCompositor {
function addShellSurface(shellSurface) {
shellSurfaces.append({shSurface: shellSurface, animatePosition: false, animateOpacity: false, level: 0});
}
- XdgShell { onToplevelCreated: addShellSurface(xdgSurface) }
- IviApplication { onIviSurfaceCreated: addShellSurface(iviSurface) }
- WlShell { onWlShellSurfaceCreated: addShellSurface(shellSurface) }
+ XdgShell { onToplevelCreated: (toplevel, xdgSurface) => addShellSurface(xdgSurface) }
+ IviApplication { onIviSurfaceCreated: (iviSurface) => addShellSurface(iviSurface) }
+ WlShell { onWlShellSurfaceCreated: (shellSurface) => addShellSurface(shellSurface) }
}
diff --git a/examples/wayland/ivi-compositor/main.qml b/examples/wayland/ivi-compositor/main.qml
index 055d10d30..555f6467c 100644
--- a/examples/wayland/ivi-compositor/main.qml
+++ b/examples/wayland/ivi-compositor/main.qml
@@ -48,14 +48,15 @@ WaylandCompositor {
onWidthChanged: handleResized()
onHeightChanged: handleResized()
function handleResized() {
- shellSurface.sendConfigure(Qt.size(width, height));
+ if (width > 0 && height > 0)
+ shellSurface.sendConfigure(Qt.size(width, height));
}
//! [resizing]
}
}
//! [connecting]
IviApplication {
- onIviSurfaceCreated: {
+ onIviSurfaceCreated: (iviSurface) => {
var surfaceArea = iviSurface.iviId === 1337 ? leftArea : rightArea;
var item = chromeComponent.createObject(surfaceArea, { "shellSurface": iviSurface } );
item.handleResized();
diff --git a/examples/wayland/minimal-qml/main.qml b/examples/wayland/minimal-qml/main.qml
index b7bcc4ca5..e1e1c18d3 100644
--- a/examples/wayland/minimal-qml/main.qml
+++ b/examples/wayland/minimal-qml/main.qml
@@ -46,17 +46,13 @@ WaylandCompositor {
//! [shells]
WlShell {
- onWlShellSurfaceCreated:
- shellSurfaces.append({shellSurface: shellSurface});
+ onWlShellSurfaceCreated: (shellSurface) => shellSurfaces.append({shellSurface: shellSurface});
}
XdgShell {
- onToplevelCreated:
- shellSurfaces.append({shellSurface: xdgSurface});
+ onToplevelCreated: (toplevel, xdgSurface) => shellSurfaces.append({shellSurface: xdgSurface});
}
IviApplication {
- onIviSurfaceCreated: {
- shellSurfaces.append({shellSurface: iviSurface});
- }
+ onIviSurfaceCreated: (iviSurface) => shellSurfaces.append({shellSurface: iviSurface});
}
//! [shells]
diff --git a/examples/wayland/multi-output/qml/ShellScreen.qml b/examples/wayland/multi-output/qml/ShellScreen.qml
index ae4092594..ffbb9f520 100644
--- a/examples/wayland/multi-output/qml/ShellScreen.qml
+++ b/examples/wayland/multi-output/qml/ShellScreen.qml
@@ -32,7 +32,7 @@ WaylandOutput {
id: clientCursor
x: mouseTracker.mouseX
y: mouseTracker.mouseY
- visible: surface !== null && mouseTracker.containsMouse
+ visible: surface != null && mouseTracker.containsMouse
seat : output.compositor.defaultSeat
}
}
diff --git a/examples/wayland/multi-output/qml/main.qml b/examples/wayland/multi-output/qml/main.qml
index 65b343ae4..26e227bcf 100644
--- a/examples/wayland/multi-output/qml/main.qml
+++ b/examples/wayland/multi-output/qml/main.qml
@@ -4,7 +4,6 @@
import QtQuick
import QtWayland.Compositor
import QtWayland.Compositor.XdgShell
-import QtWayland.Compositor.WlShell
WaylandCompositor {
id: comp
@@ -50,7 +49,7 @@ WaylandCompositor {
// ![xdgshell]
XdgShell {
- onToplevelCreated: {
+ onToplevelCreated: (toplevel, xdgSurface) => {
var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "shellSurface": xdgSurface } );
item.surface.activated.connect(item.raise);
}
@@ -58,7 +57,7 @@ WaylandCompositor {
// ![xdgshell]
// ![onSurfaceRequested]
- onSurfaceRequested: {
+ onSurfaceRequested: (client, id, version) => {
var surface = surfaceComponent.createObject(comp, { } );
surface.initialize(comp, client, id, version);
}
diff --git a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
index 9573cedfe..07374b784 100644
--- a/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
+++ b/examples/wayland/multi-screen/doc/src/multi-screen.qdoc
@@ -45,7 +45,7 @@
* screens. The global position of the client is stored in a shared
* \l{ShellSurfaceItem::moveItem}{moveItem} and relative position of each screen's
* \l ShellSurfaceItem is calculated based on this. If the \c moveItem is currently outside the
- * bounds of one screen, its coordinates will reflect this, and it will be not be visible on that
+ * bounds of one screen, its coordinates will reflect this, and it will not be visible on that
* screen.
*
* \snippet multi-screen/qml/Chrome.qml position sync
diff --git a/examples/wayland/multi-screen/qml/CompositorScreen.qml b/examples/wayland/multi-screen/qml/CompositorScreen.qml
index 5f1b34472..e449d6fa8 100644
--- a/examples/wayland/multi-screen/qml/CompositorScreen.qml
+++ b/examples/wayland/multi-screen/qml/CompositorScreen.qml
@@ -46,7 +46,7 @@ WaylandOutput {
x: mouseTracker.mouseX
y: mouseTracker.mouseY
seat: comp.defaultSeat
- visible: surface !== null && mouseTracker.containsMouse
+ visible: surface != null && mouseTracker.containsMouse
}
}
Shortcut {
diff --git a/examples/wayland/multi-screen/qml/main.qml b/examples/wayland/multi-screen/qml/main.qml
index dc2807c3c..fc14d0a7d 100644
--- a/examples/wayland/multi-screen/qml/main.qml
+++ b/examples/wayland/multi-screen/qml/main.qml
@@ -4,7 +4,6 @@
import QtQml
import QtQuick
-import QtQuick.Window as Window
import QtWayland.Compositor
import QtWayland.Compositor.XdgShell
import QtWayland.Compositor.WlShell
@@ -54,11 +53,11 @@ WaylandCompositor {
}
WlShell {
- onWlShellSurfaceCreated: handleShellSurfaceCreated(shellSurface)
+ onWlShellSurfaceCreated: (shellSurface) => handleShellSurfaceCreated(shellSurface)
}
XdgShell {
- onToplevelCreated: handleShellSurfaceCreated(xdgSurface)
+ onToplevelCreated: (toplevel, xdgSurface) => handleShellSurfaceCreated(xdgSurface)
}
function createShellSurfaceItem(shellSurface, moveItem, output) {
diff --git a/examples/wayland/overview-compositor/main.qml b/examples/wayland/overview-compositor/main.qml
index 5e6930d20..026e5caba 100644
--- a/examples/wayland/overview-compositor/main.qml
+++ b/examples/wayland/overview-compositor/main.qml
@@ -90,7 +90,7 @@ WaylandCompositor {
// ![XdgShell]
XdgShell {
- onToplevelCreated: {
+ onToplevelCreated: (toplevel, xdgSurface) => {
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 80faa80dd..87feedf14 100644
--- a/examples/wayland/pure-qml/qml/main.qml
+++ b/examples/wayland/pure-qml/qml/main.qml
@@ -16,17 +16,17 @@ 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)
+ onToplevelCreated: (toplevel, xdgSurface) => screen.handleShellSurface(xdgSurface)
}
// Minimalistic shell extension. Mainly used for embedded applications.
IviApplication {
- onIviSurfaceCreated: screen.handleShellSurface(iviSurface)
+ onIviSurfaceCreated: (iviSurface) => screen.handleShellSurface(iviSurface)
}
// Deprecated shell extension, still used by some clients
WlShell {
- onWlShellSurfaceCreated: screen.handleShellSurface(shellSurface)
+ onWlShellSurfaceCreated: (shellSurface) => screen.handleShellSurface(shellSurface)
}
// ![shell extensions]
diff --git a/examples/wayland/qtshell/qml/main.qml b/examples/wayland/qtshell/qml/main.qml
index 99813b576..7a4f505d5 100644
--- a/examples/wayland/qtshell/qml/main.qml
+++ b/examples/wayland/qtshell/qml/main.qml
@@ -15,7 +15,7 @@ WaylandCompositor {
//! [shell]
QtShell {
- onQtShellSurfaceCreated: screen.handleShellSurface(qtShellSurface)
+ onQtShellSurfaceCreated: (qtShellSurface) => screen.handleShellSurface(qtShellSurface)
}
//! [shell]
}
diff --git a/examples/wayland/server-buffer/CMakeLists.txt b/examples/wayland/server-buffer/CMakeLists.txt
index 48a68e96b..973063c71 100644
--- a/examples/wayland/server-buffer/CMakeLists.txt
+++ b/examples/wayland/server-buffer/CMakeLists.txt
@@ -1,2 +1,5 @@
-qt_internal_add_example(cpp-client)
-qt_internal_add_example(compositor)
+cmake_minimum_required(VERSION 3.16)
+project(server-buffer)
+
+add_subdirectory(cpp-client)
+add_subdirectory(compositor)
diff --git a/examples/wayland/server-buffer/compositor/qml/main.qml b/examples/wayland/server-buffer/compositor/qml/main.qml
index dc2a2fb8c..484a9563c 100644
--- a/examples/wayland/server-buffer/compositor/qml/main.qml
+++ b/examples/wayland/server-buffer/compositor/qml/main.qml
@@ -24,6 +24,7 @@ WaylandCompositor {
}
}
}
+
Component {
id: chromeComponent
ShellSurfaceItem {
@@ -32,11 +33,11 @@ WaylandCompositor {
}
WlShell {
- onWlShellSurfaceCreated:
+ onWlShellSurfaceCreated: (shellSurface) => {
chromeComponent.createObject(surfaceArea, { "shellSurface": shellSurface } );
+ }
}
ShareBufferExtension {
}
-
}
diff --git a/examples/wayland/server-side-decoration/main.qml b/examples/wayland/server-side-decoration/main.qml
index 881ee9bf3..421cefa95 100644
--- a/examples/wayland/server-side-decoration/main.qml
+++ b/examples/wayland/server-side-decoration/main.qml
@@ -63,7 +63,7 @@ WaylandCompositor {
// ![XdgShell]
XdgShell {
- onToplevelCreated: shellSurfaces.append({shellSurface: xdgSurface});
+ onToplevelCreated: (toplevel, xdgSurface) => shellSurfaces.append({shellSurface: xdgSurface});
}
XdgDecorationManagerV1 {
preferredMode: XdgToplevel.ServerSideDecoration
diff --git a/examples/wayland/spanning-screens/main.qml b/examples/wayland/spanning-screens/main.qml
index bff344b7d..d47246dee 100644
--- a/examples/wayland/spanning-screens/main.qml
+++ b/examples/wayland/spanning-screens/main.qml
@@ -65,7 +65,7 @@ WaylandCompositor {
}
XdgShell {
- onToplevelCreated: {
+ onToplevelCreated: (toplevel, xdgSurface) => {
const shellSurface = xdgSurface;
// ![create items]
diff --git a/src/compositor/qmlfiles/WaylandCursorItem.qml b/src/compositor/qmlfiles/WaylandCursorItem.qml
index 1153038b9..dfa704176 100644
--- a/src/compositor/qmlfiles/WaylandCursorItem.qml
+++ b/src/compositor/qmlfiles/WaylandCursorItem.qml
@@ -22,7 +22,7 @@ WaylandQuickItem {
Connections {
target: seat
- onCursorSurfaceRequest: {
+ function onCursorSurfaceRequest(surface, hotspotX, hotspotY) {
cursorItem.surface = surface;
cursorItem.hotspotX = hotspotX;
cursorItem.hotspotY = hotspotY;
@@ -41,7 +41,9 @@ WaylandQuickItem {
Connections {
target: dragIcon.surface
- onOffsetForNextFrame: dragIcon.offset = offset;
+ function onOffsetForNextFrame(offset) {
+ dragIcon.offset = offset;
+ }
}
}
}