diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2017-10-27 10:37:21 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2017-10-27 10:37:21 +0200 |
commit | 62293cefae129bbfebb0317b39d059b0abb1a16a (patch) | |
tree | 159080c98a85baa02e34776cf2618642ae55d456 /src/compositor/compositor_api/qwaylandseat.cpp | |
parent | c2b272ac73617a8d5ff25151534feda95ace63ee (diff) | |
parent | 523cf490b4c46916c6f5253c666a492f5cce2aad (diff) |
Merge remote-tracking branch 'qt/5.10' into dev
Change-Id: I4f885a551093ada07da97fd3d99902e36f98595e
Diffstat (limited to 'src/compositor/compositor_api/qwaylandseat.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandseat.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp index 474ebc0e5..4b506bcda 100644 --- a/src/compositor/compositor_api/qwaylandseat.cpp +++ b/src/compositor/compositor_api/qwaylandseat.cpp @@ -548,6 +548,12 @@ void QWaylandSeat::setMouseFocus(QWaylandView *view) QWaylandView *oldFocus = d->mouseFocus; d->mouseFocus = view; + + if (oldFocus) + disconnect(oldFocus, &QObject::destroyed, this, &QWaylandSeat::handleMouseFocusDestroyed); + if (d->mouseFocus) + connect(d->mouseFocus, &QObject::destroyed, this, &QWaylandSeat::handleMouseFocusDestroyed); + emit mouseFocusChanged(d->mouseFocus, oldFocus); } @@ -604,4 +610,15 @@ QWaylandSeat *QWaylandSeat::fromSeatResource(struct ::wl_resource *resource) * This signal is emitted when the mouse focus has changed from \a oldFocus to \a newFocus. */ +void QWaylandSeat::handleMouseFocusDestroyed() +{ + // This is triggered when the QWaylandView is destroyed, NOT the surface. + // ... so this is for the rare case when the view that currently holds the mouse focus is + // destroyed before its surface + Q_D(QWaylandSeat); + d->mouseFocus = nullptr; + QWaylandView *oldFocus = nullptr; // we have to send nullptr because the old focus is already destroyed at this point + emit mouseFocusChanged(d->mouseFocus, oldFocus); +} + QT_END_NAMESPACE |