summaryrefslogtreecommitdiffstats
path: root/examples/wayland/pure-qml
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-24 16:51:01 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:10:33 +0200
commitd2d70779224b067f6035f431319036054272ce65 (patch)
tree0ea297990553ff75cf82fb840d59dde903903dcd /examples/wayland/pure-qml
parent88f821e189bd1d4d4550c1864f622ca7df2a7c34 (diff)
Make the default wl_shell available from QML
This finaly ties together how to use QWaylandQuickItems with different shells It was required to decouple QWaylandView from the QWaylandQuickItem since QML doesn't play to well with muliple inheritance. The QWaylandQuickItem can be retrieved from the QWaylandView which is now conveniently a QObject. Also the QWaylandQuickItem owns the QWaylandView. This architecture also leaves room for creating a QWaylandWidget :) Change-Id: Ib8a00e6f17f0f1bfc3ff244753f021c76db22cb1
Diffstat (limited to 'examples/wayland/pure-qml')
-rw-r--r--examples/wayland/pure-qml/qml/Chrome.qml12
-rw-r--r--examples/wayland/pure-qml/qml/main.qml23
2 files changed, 24 insertions, 11 deletions
diff --git a/examples/wayland/pure-qml/qml/Chrome.qml b/examples/wayland/pure-qml/qml/Chrome.qml
index 8e3ae454f..4a365fc7b 100644
--- a/examples/wayland/pure-qml/qml/Chrome.qml
+++ b/examples/wayland/pure-qml/qml/Chrome.qml
@@ -41,12 +41,10 @@
import QtQuick 2.0
import QtWayland.Compositor 1.0
-WaylandView {
+WaylandQuickItem {
id: rootChrome
x: clampXPos()
y: clampYPos()
- width: childrenRect.width
- height: childrenRect.height
onSurfaceDestroyed: {
lockedBuffer = true;
@@ -73,13 +71,13 @@ WaylandView {
]
function clampXPos() {
if (!parent)
- return requestedXPosition;
- return Math.max(Math.min(requestedXPosition, parent.width - 10), 0)
+ return view.requestedXPosition;
+ return Math.max(Math.min(view.requestedXPosition, parent.width - 10), 0)
}
function clampYPos() {
if (!parent)
- return requestedYPosition;
- return Math.max(Math.min(requestedYPosition, parent.height - 30), 0)
+ return view.requestedYPosition;
+ return Math.max(Math.min(view.requestedYPosition, parent.height - 30), 0)
}
}
diff --git a/examples/wayland/pure-qml/qml/main.qml b/examples/wayland/pure-qml/qml/main.qml
index 18fd45fa1..121cb0d2a 100644
--- a/examples/wayland/pure-qml/qml/main.qml
+++ b/examples/wayland/pure-qml/qml/main.qml
@@ -44,6 +44,8 @@ import QtWayland.Compositor 1.0
WaylandCompositor {
id: compositor
+ property var primarySurfacesArea: null
+
Component {
id: screenComponent
Screen { }
@@ -54,17 +56,30 @@ WaylandCompositor {
Chrome { }
}
+ extensions: [
+ DefaultShell {
+
+ onShellSurfaceCreated: {
+ var item = chromeComponent.createObject(primarySurfacesArea);
+ item.surface = surface;
+ item.followRequestedPosition = true;
+ shellSurface.view = item.view;
+ }
+
+ Component.onCompleted: {
+ initialize();
+ }
+ }
+ ]
+
Component.onCompleted: {
addScreen();
}
function addScreen() {
var screen = screenComponent.createObject(0, { "compositor" : compositor } );
+ primarySurfacesArea = screen.surfacesArea;
var output = compositor.primaryOutputSpace.addOutputWindow(screen, "", "");
output.automaticFrameCallbacks = true;
}
-
- onSurfaceCreated: {
- var chrome = chromeComponent.createObject(primaryOutputSpace.primaryOutput.window.surfacesArea, { "surface" : surface } );
- }
}