diff options
author | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2017-09-19 07:56:05 +0900 |
---|---|---|
committer | Elvis Lee <kwangwoong.lee@lge.com> | 2021-02-22 17:07:14 +0900 |
commit | bf60784393552a605d166330d3fdc87e900e8a0b (patch) | |
tree | e22c9e2b5ac8a00ba75cd4e8ebcf0f611b135da0 /src | |
parent | dcfb4ae6f9b2e2324fd2a8b6f1b20c5ae25f385b (diff) |
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."
Pick-to: 6.1
Change-Id: I1cd1345d6479877925c200859868ae8717afd1fa
Reviewed-by: Elvis Lee <kwangwoong.lee@lge.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src')
-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 3a3ecde47..302e7cdd0 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 61a2da6f7..591674ce8 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 e77126e28..44458ae54 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(); |