From b1cae06cb65658dcddf01a596ea95cfd7c0ebdc2 Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Thu, 11 May 2023 12:26:15 +0300 Subject: client: Implement cursor_shape_v1 A new wayland protocol allows clients to specify the cursor being used rather than load themes and attach buffers. Short term this has better behavior for scaling. Long term when this has universal compositor support we can drop the theme loading code. Change-Id: I119e1ca44d351e7b13b8ec56f2218d94b7da0705 Reviewed-by: Vlad Zahorodnii Reviewed-by: Eskil Abrahamsen Blomfeldt --- tests/auto/client/shared/CMakeLists.txt | 1 + tests/auto/client/shared/coreprotocol.cpp | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'tests/auto/client/shared') diff --git a/tests/auto/client/shared/CMakeLists.txt b/tests/auto/client/shared/CMakeLists.txt index a1f150c22..ee81b4d68 100644 --- a/tests/auto/client/shared/CMakeLists.txt +++ b/tests/auto/client/shared/CMakeLists.txt @@ -39,6 +39,7 @@ add_library(SharedClientTest qt6_generate_wayland_protocol_server_sources(SharedClientTest FILES + ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/cursor-shape-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/fullscreen-shell-unstable-v1.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/ivi-application.xml ${PROJECT_SOURCE_DIR}/src/3rdparty/protocol/wp-primary-selection-unstable-v1.xml diff --git a/tests/auto/client/shared/coreprotocol.cpp b/tests/auto/client/shared/coreprotocol.cpp index 15be62ccb..64586d413 100644 --- a/tests/auto/client/shared/coreprotocol.cpp +++ b/tests/auto/client/shared/coreprotocol.cpp @@ -435,15 +435,19 @@ void Pointer::sendAxisValue120(wl_client *client, QtWaylandServer::wl_pointer::a void Pointer::pointer_set_cursor(Resource *resource, uint32_t serial, wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y) { Q_UNUSED(resource); - auto *s = fromResource(surface); - QVERIFY(s); - if (s->m_role) { - m_cursorRole = CursorRole::fromSurface(s); - QVERIFY(m_cursorRole); + if (!surface) { + m_cursorRole = nullptr; } else { - m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole - s->m_role = m_cursorRole; + auto *s = fromResource(surface); + QVERIFY(s); + if (s->m_role) { + m_cursorRole = CursorRole::fromSurface(s); + QVERIFY(m_cursorRole); + } else { + m_cursorRole = new CursorRole(s); //TODO: make sure we don't leak CursorRole + s->m_role = m_cursorRole; + } } // Directly checking the last serial would be racy, we may just have sent leaves/enters which -- cgit v1.2.3