diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-09-21 12:01:02 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-09-28 12:03:07 +0000 |
commit | 21ab16ca3c8d19a31d915d8fe46172a0d6b73bd3 (patch) | |
tree | 188c371e113f8b612583468b2cc89963fe4e61de /src/compositor/compositor_api/qwaylandpointer.cpp | |
parent | 8d437e79cdd41ede195ed1829d59b2b012b4d40d (diff) |
Compositor: Return event serials from mouse press functions
Change-Id: Idbfa41edc7bad23dcd606da56b99a85367006fe8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor/compositor_api/qwaylandpointer.cpp')
-rw-r--r-- | src/compositor/compositor_api/qwaylandpointer.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp index 742987c8b..5581a5c10 100644 --- a/src/compositor/compositor_api/qwaylandpointer.cpp +++ b/src/compositor/compositor_api/qwaylandpointer.cpp @@ -151,34 +151,45 @@ void QWaylandPointer::setOutput(QWaylandOutput *output) /*! * Sends a mouse press event for \a button to the view currently holding mouse focus. + * + * Returns the serial number of the press event. */ -void QWaylandPointer::sendMousePressEvent(Qt::MouseButton button) +uint QWaylandPointer::sendMousePressEvent(Qt::MouseButton button) { Q_D(QWaylandPointer); uint32_t time = d->compositor()->currentTimeMsecs(); d->buttonCount++; + uint serial = 0; + if (d->focusResource) - sendButton(d->focusResource, time, button, WL_POINTER_BUTTON_STATE_PRESSED); + serial = sendButton(d->focusResource, time, button, WL_POINTER_BUTTON_STATE_PRESSED); if (d->buttonCount == 1) { emit buttonPressedChanged(); } + + return serial; } /*! * Sends a mouse release event for \a button to the view currently holding mouse focus. + * + * Returns the serial number of the release event. */ -void QWaylandPointer::sendMouseReleaseEvent(Qt::MouseButton button) +uint QWaylandPointer::sendMouseReleaseEvent(Qt::MouseButton button) { Q_D(QWaylandPointer); uint32_t time = d->compositor()->currentTimeMsecs(); d->buttonCount--; + uint serial = 0; if (d->focusResource) - sendButton(d->focusResource, time, button, WL_POINTER_BUTTON_STATE_RELEASED); + serial = sendButton(d->focusResource, time, button, WL_POINTER_BUTTON_STATE_RELEASED); if (d->buttonCount == 0) emit buttonPressedChanged(); + + return serial; } /*! @@ -308,11 +319,12 @@ struct wl_resource *QWaylandPointer::focusResource() const /*! * \internal */ -void QWaylandPointer::sendButton(struct wl_resource *resource, uint32_t time, Qt::MouseButton button, uint32_t state) +uint QWaylandPointer::sendButton(struct wl_resource *resource, uint32_t time, Qt::MouseButton button, uint32_t state) { Q_D(QWaylandPointer); uint32_t serial = d->compositor()->nextSerial(); d->send_button(resource, serial, time, toWaylandButton(button), state); + return serial; } /*! |