summaryrefslogtreecommitdiffstats
path: root/tests/auto/client/shared
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2023-05-11 12:26:15 +0300
committerDavid Edmundson <davidedmundson@kde.org>2023-06-01 14:57:20 +0000
commitb1cae06cb65658dcddf01a596ea95cfd7c0ebdc2 (patch)
tree6b669599ad016d93a5f8b46613ed512f5672f474 /tests/auto/client/shared
parent9b3a347d6cc3bbc40071f245344b7bff9e6c2d96 (diff)
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 <vlad.zahorodnii@kde.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/client/shared')
-rw-r--r--tests/auto/client/shared/CMakeLists.txt1
-rw-r--r--tests/auto/client/shared/coreprotocol.cpp18
2 files changed, 12 insertions, 7 deletions
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>(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>(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