summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandpointer.cpp
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-05-07 17:10:07 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:09:42 +0200
commit65800110cb5887c1c110d44307d90c89d708bf9a (patch)
treef8eb59adc56fd8a2f433f1b73047570ff3345795 /src/compositor/compositor_api/qwaylandpointer.cpp
parent8ea41bfe32de3b4dd4c15ec91c8925b1c6508c53 (diff)
Mouse mouseFocus handling to the QWaylandInputDevice
This because both the touch interface and pointer interface depends on it Change-Id: I64718e0db87085c656250a22107715ddb68bc9ae
Diffstat (limited to 'src/compositor/compositor_api/qwaylandpointer.cpp')
-rw-r--r--src/compositor/compositor_api/qwaylandpointer.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp
index 07f327adf..6262f9b92 100644
--- a/src/compositor/compositor_api/qwaylandpointer.cpp
+++ b/src/compositor/compositor_api/qwaylandpointer.cpp
@@ -49,6 +49,7 @@ QWaylandPointer::QWaylandPointer(QWaylandInputDevice *seat, QObject *parent)
: QObject(* new QWaylandPointerPrivate(this, seat), parent)
{
connect(&d_func()->m_focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandPointer::focusDestroyed);
+ connect(seat, &QWaylandInputDevice::mouseFocusChanged, this, &QWaylandPointer::pointerFocusChanged);
}
void QWaylandDefaultPointerGrabber::focus()
@@ -160,12 +161,6 @@ void QWaylandPointer::sendMouseWheelEvent(Qt::Orientation orientation, int delta
d->sendMouseWheelEvent(orientation, delta);
}
-void QWaylandPointer::resetCurrentView()
-{
- Q_D(QWaylandPointer);
- d->resetCurrentState();
-}
-
QWaylandSurfaceView *QWaylandPointer::currentView() const
{
Q_D(const QWaylandPointer);
@@ -202,6 +197,9 @@ struct wl_resource *QWaylandPointer::focusResource() const
if (!d->focusResource())
return Q_NULLPTR;
+ if (!d->focusResource())
+ return Q_NULLPTR;
+
return d->focusResource()->handle;
}
@@ -247,11 +245,26 @@ void QWaylandPointer::focusDestroyed(void *data)
Q_UNUSED(data)
d->m_focusDestroyListener.reset();
- d->m_currentPosition.reset();
+ inputDevice()->setMouseFocus(Q_NULLPTR);
d->m_focusResource = 0;
d->m_buttonCount = 0;
endGrab();
}
+void QWaylandPointer::pointerFocusChanged(QWaylandSurfaceView *newFocus, QWaylandSurfaceView *oldFocus)
+{
+ Q_UNUSED(newFocus);
+ Q_D(QWaylandPointer);
+ d->m_localPosition = QPointF();
+ d->m_hasSentEnter = false;
+ if (d->m_focusResource && oldFocus) {
+ uint32_t serial = compositor()->nextSerial();
+ d->send_leave(d->m_focusResource->handle, serial, oldFocus->surfaceResource());
+ d->m_focusDestroyListener.reset();
+ d->m_focusResource = 0;
+ }
+
+}
+
QT_END_NAMESPACE