diff options
-rw-r--r-- | examples/wayland/multi-output/qml/GridScreen.qml | 5 | ||||
-rw-r--r-- | examples/wayland/multi-output/qml/main.qml | 3 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 18 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.h | 2 |
4 files changed, 27 insertions, 1 deletions
diff --git a/examples/wayland/multi-output/qml/GridScreen.qml b/examples/wayland/multi-output/qml/GridScreen.qml index 83f9c320..e7293731 100644 --- a/examples/wayland/multi-output/qml/GridScreen.qml +++ b/examples/wayland/multi-output/qml/GridScreen.qml @@ -66,12 +66,17 @@ WaylandOutput { cellWidth: 200 cellHeight: 200 delegate: WaylandQuickItem { + id: item surface: gridSurface width: gridView.cellWidth height: gridView.cellHeight sizeFollowsSurface: false inputEventsEnabled: false view.discardFrontBuffers: true + MouseArea { + anchors.fill: parent + onClicked: item.surface.activated() + } } } } diff --git a/examples/wayland/multi-output/qml/main.qml b/examples/wayland/multi-output/qml/main.qml index 0a479157..e04f3cac 100644 --- a/examples/wayland/multi-output/qml/main.qml +++ b/examples/wayland/multi-output/qml/main.qml @@ -65,6 +65,7 @@ WaylandCompositor { id: surfaceComponent WaylandSurface { id: surface + signal activated() onMappedChanged: { if (isMapped && !cursorSurface) { gridScreen.gridSurfaces.append( { "gridSurface" : surface } ); @@ -87,7 +88,7 @@ WaylandCompositor { onCreateShellSurface: { var item = chromeComponent.createObject(defaultOutput.surfaceArea, { "surface": surface } ); item.shellSurface.initialize(defaultShell, surface, client, id); - item.surface + surface.activated.connect(item.raise); } Component.onCompleted: { diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 4928389f..eea2814b 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -588,4 +588,22 @@ void QWaylandQuickItem::setInputEventsEnabled(bool enabled) } } +void QWaylandQuickItem::lower() +{ + QQuickItem *parent = parentItem(); + Q_ASSERT(parent); + QQuickItem *bottom = parent->childItems().first(); + if (this != bottom) + stackBefore(bottom); +} + +void QWaylandQuickItem::raise() +{ + QQuickItem *parent = parentItem(); + Q_ASSERT(parent); + QQuickItem *top = parent->childItems().last(); + if (this != top) + stackAfter(top); +} + QT_END_NAMESPACE diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 81322451..7737fe30 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -118,6 +118,8 @@ protected: public Q_SLOTS: virtual void takeFocus(QWaylandInputDevice *device = 0); void setPaintEnabled(bool paintEnabled); + void raise(); + void lower(); private Q_SLOTS: void surfaceMappedChanged(); |