diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-06 13:41:27 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-08-28 13:10:32 +0200 |
commit | fd9a8983832bbeb240097327ff9f8565f7356b08 (patch) | |
tree | db359b31c502694b3c33e451825fda7257c31bc1 /examples | |
parent | e6a44555c60859fd61a6cc78140a36fa36e7b9f5 (diff) |
Fixups after rebasing
Change-Id: Ie5d8899157d77f83f2cf65f236d534b972aa4770
Diffstat (limited to 'examples')
-rw-r--r-- | examples/wayland/qwindow-compositor/qwindowcompositor.cpp | 21 | ||||
-rw-r--r-- | examples/wayland/qwindow-compositor/qwindowcompositor.h | 5 |
2 files changed, 16 insertions, 10 deletions
diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp index 0f8462211..bb8d3463a 100644 --- a/examples/wayland/qwindow-compositor/qwindowcompositor.cpp +++ b/examples/wayland/qwindow-compositor/qwindowcompositor.cpp @@ -179,9 +179,16 @@ void QWindowCompositor::surfaceDestroyed() m_renderScheduler.start(0); } -void QWindowCompositor::surfaceMapped() +void QWindowCompositor::surfaceMappedChanged() { QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender()); + if (surface->isMapped()) + surfaceMapped(surface); + else + surfaceUnmapped(surface); +} +void QWindowCompositor::surfaceMapped(QWaylandSurface *surface) +{ QtWayland::ShellSurface *shellSurface = QtWayland::ShellSurface::findIn(surface); QPoint pos; if (!m_surfaces.contains(surface)) { @@ -206,16 +213,15 @@ void QWindowCompositor::surfaceMapped() } m_surfaces.append(surface); - defaultInputDevice()->setKeyboardFocus(surface); + if (!surface->isCursorSurface()) + defaultInputDevice()->setKeyboardFocus(surface); m_renderScheduler.start(0); } -void QWindowCompositor::surfaceUnmapped() +void QWindowCompositor::surfaceUnmapped(QWaylandSurface *surface) { - QWaylandSurface *surface = qobject_cast<QWaylandSurface *>(sender()); - if (m_surfaces.removeOne(surface)) - m_surfaces.insert(0, surface); + m_surfaces.removeOne(surface); ensureKeyboardFocusSurface(surface); m_renderScheduler.start(0); @@ -241,8 +247,7 @@ void QWindowCompositor::surfaceCommitted(QWaylandSurface *surface) void QWindowCompositor::onSurfaceCreated(QWaylandSurface *surface) { connect(surface, SIGNAL(surfaceDestroyed()), this, SLOT(surfaceDestroyed())); - connect(surface, SIGNAL(mapped()), this, SLOT(surfaceMapped())); - connect(surface, SIGNAL(unmapped()), this, SLOT(surfaceUnmapped())); + connect(surface, SIGNAL(mappedChanged()), this, SLOT(surfaceMappedChanged())); connect(surface, SIGNAL(redraw()), this, SLOT(surfaceCommitted())); connect(surface, SIGNAL(extendedSurfaceReady()), this, SLOT(sendExpose())); } diff --git a/examples/wayland/qwindow-compositor/qwindowcompositor.h b/examples/wayland/qwindow-compositor/qwindowcompositor.h index 7534b57b0..2ac302f2f 100644 --- a/examples/wayland/qwindow-compositor/qwindowcompositor.h +++ b/examples/wayland/qwindow-compositor/qwindowcompositor.h @@ -70,9 +70,8 @@ public: void create() Q_DECL_OVERRIDE; private slots: + void surfaceMappedChanged(); void surfaceDestroyed(); - void surfaceMapped(); - void surfaceUnmapped(); void surfaceCommitted(); void surfacePosChanged(); @@ -98,6 +97,8 @@ private slots: void updateCursor(bool hasBuffer); private: + void surfaceMapped(QWaylandSurface *surface); + void surfaceUnmapped(QWaylandSurface *surface); void drawSubSurface(const QPoint &offset, QWaylandSurface *surface); CompositorWindow *m_window; |