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 <paul.tvete@qt.io>
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
Johan Klokkhammer Helsing 2018-11-20 09:47:02 +01:00 committed by Johan Helsing
parent a544de1bc0
commit a800b2951e

View File

@ -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);