diff options
author | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2017-09-19 07:56:05 +0900 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-02-22 09:43:11 +0000 |
commit | ac8ed809a859ed4642676ce26381fe4a2c17a3c2 (patch) | |
tree | 6d4547404c38d3c9895f83a41202bfbf97766a17 | |
parent | fb3081f7c0810198914bac29296618119bb0565c (diff) | |
download | qtwayland-ac8ed809a859ed4642676ce26381fe4a2c17a3c2.tar.gz |
Add client parameter for set_cursor
Identify the sender of set_cursor request to determine
surfaces that the cursor surface is associated with.
New signal cursorSurfaceRequested is added.
And the old signal cursorSurfaceRequest is deprecated.
A quote from the wayland protocol spec -
"The cursor actually changes only if the pointer focus for this device
is one of the requesting client's surfaces or the surface parameter is
the current pointer surface."
Change-Id: I1cd1345d6479877925c200859868ae8717afd1fa
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
(cherry picked from commit bf60784393552a605d166330d3fdc87e900e8a0b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/compositor/compositor_api/qwaylandpointer.cpp | 9 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandseat.cpp | 3 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandseat.h | 3 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp index 3a3ecde4..302e7cdd 100644 --- a/src/compositor/compositor_api/qwaylandpointer.cpp +++ b/src/compositor/compositor_api/qwaylandpointer.cpp @@ -90,10 +90,10 @@ void QWaylandPointerPrivate::sendLeave() uint32_t serial = compositor()->nextSerial(); for (auto resource : resourceMap().values(enteredSurface->waylandClient())) send_leave(resource->handle, serial, enteredSurface->resource()); - enteredSurface = nullptr; localPosition = QPointF(); enteredSurfaceDestroyListener.reset(); - seat->cursorSurfaceRequest(nullptr, 0, 0); + seat->cursorSurfaceRequested(nullptr, 0, 0, QWaylandClient::fromWlClient(compositor(), enteredSurface->waylandClient())); + enteredSurface = nullptr; } void QWaylandPointerPrivate::ensureEntered(QWaylandSurface *surface) @@ -115,11 +115,10 @@ void QWaylandPointerPrivate::pointer_release(wl_pointer::Resource *resource) void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { - Q_UNUSED(resource); Q_UNUSED(serial); if (!surface) { - seat->cursorSurfaceRequest(nullptr, 0, 0); + seat->cursorSurfaceRequested(nullptr, 0, 0, QWaylandClient::fromWlClient(compositor(), resource->client())); return; } @@ -134,7 +133,7 @@ void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource, wl_resource *displayRes = wl_client_get_object(resource->client(), 1); if (s->setRole(&QWaylandPointerPrivate::s_role, displayRes, WL_DISPLAY_ERROR_INVALID_OBJECT)) { s->markAsCursorSurface(true); - seat->cursorSurfaceRequest(s, hotspot_x, hotspot_y); + seat->cursorSurfaceRequested(s, hotspot_x, hotspot_y, QWaylandClient::fromWlClient(compositor(), resource->client())); } } diff --git a/src/compositor/compositor_api/qwaylandseat.cpp b/src/compositor/compositor_api/qwaylandseat.cpp index 61a2da6f..591674ce 100644 --- a/src/compositor/compositor_api/qwaylandseat.cpp +++ b/src/compositor/compositor_api/qwaylandseat.cpp @@ -178,6 +178,9 @@ QWaylandSeat::QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capab d->capabilities = capabilityFlags; if (compositor->isCreated()) initialize(); + + // Support deprecated signal for backward compatibility + connect(this, &QWaylandSeat::cursorSurfaceRequested, this, &QWaylandSeat::cursorSurfaceRequest); } /*! diff --git a/src/compositor/compositor_api/qwaylandseat.h b/src/compositor/compositor_api/qwaylandseat.h index e77126e2..44458ae5 100644 --- a/src/compositor/compositor_api/qwaylandseat.h +++ b/src/compositor/compositor_api/qwaylandseat.h @@ -134,7 +134,10 @@ public: Q_SIGNALS: void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus); void keyboardFocusChanged(QWaylandSurface *newFocus, QWaylandSurface *oldFocus); +#if QT_DEPRECATED_SINCE(6, 1) void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY); +#endif + void cursorSurfaceRequested(QWaylandSurface *surface, int hotspotX, int hotspotY, QWaylandClient *client); private: void handleMouseFocusDestroyed(); |