From a800b2951e52cc0a8d0d3313d5281dbb806c5053 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Tue, 20 Nov 2018 09:47:02 +0100 Subject: [PATCH] Client: Don't create cursor surface until we can set its role We can't set the cursor role until we have gotten an enter event, so wait with creating the surface until we want to set the role for the first time. Makes testing easier since we don't have to deal with role-less surfaces that may or may not be the cursor surface. Change-Id: I99803d9b0b5933a271b6b1d56f74d4ff79813e40 Reviewed-by: Paul Olav Tvete Reviewed-by: David Edmundson --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 5b5ad7a3211..8f90a81a459 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -238,7 +238,6 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) if (caps & WL_SEAT_CAPABILITY_POINTER && !mPointer) { mPointer = createPointer(this); mPointer->init(get_pointer()); - pointerSurface = mQDisplay->createSurface(this); } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && mPointer) { delete mPointer; mPointer = nullptr; @@ -419,6 +418,9 @@ void QWaylandInputDevice::setCursor(struct wl_buffer *buffer, const QPoint &hotS return; } + if (!pointerSurface) + pointerSurface = mQDisplay->createSurface(this); + mPointer->set_cursor(mPointer->mEnterSerial, pointerSurface, hotSpot.x(), hotSpot.y()); wl_surface_attach(pointerSurface, buffer, 0, 0);