Wine/Wayland hides the cursor as follows:
[ 853107.473] -> wl_pointer@15.set_cursor(172832, wl_surface@38, 0, 0)
...
[ 858989.757] -> wl_surface@38.destroy()
[ 858989.759] -> wl_pointer@15.set_cursor(172832, nil, 0, 0)
i.e. it destroys the cursor surface, then calls wl_pointer.set_cursor().
SurfaceCursorSource stores the wl_surface in a QPointer, furthermore it
is going to emit the changed signal, which is needed to force the
CursorItem to update its content, only if either a new hotspot or a
surface has been passed to SurfaceCursorSource::update(). So what happens
is the following:
- The SurfaceInterface object is destroyed and the QPointer resets its
value to nullptr
- SurfaceCursorSource::update(nullptr, QPointF(0, 0)) gets called in
response to wl_pointer@15.set_cursor(nil, 0, 0)
- but since m_surface has been implicitly reset to nullptr, no changed
signal is going to be emitted
This change addresses the issue by making the SurfaceCursorSource track
the SurfaceInterface's destroyed signal.
BUG: 480582
The SurfaceCursorSource assumes that the cursor surface has a wl_shm
buffer attached to it, which is a bad assumption, as the client can
attach a buffer of any type to the surface. Furthermore, the cursor
surface can have custom transforms applied to it, for example a
wp_viewport, which current code fails to handle.
The ImageCursorSource used to be primarily a porting aid. That is, if we
couldn't port some code to SurfaceCursorSource or ShapeCursorSource, the
ImageCursorSource was used in interim. Now, all parts of kwin have been
ported to ShapeCursorSource and SurfaceCursorSource, so the image cursor
source can be dropped.
Currently the tablet cursor doesn't use SurfaceCursorSource because it
doesn't handle changing the surface size after the set_cursor request.
This change adds missing surface commit handling in the
SurfaceCursorSource so the tablet cursor can use it. As a side effect,
the pointer interface doesn't need to track surface commits anymore.
The contents of the cursor can be either a normal image or a wl_surface.
At the moment, we get an image from the wl_surface. But it's going to be
changed so we use SurfaceItem to render wl_surface cursors.
SurfaceCursorSource provides the way to get the wl_surface handle from
the cursor. In order to provide backwards compatibility, it also provides
a QImage.
ShapeCursorSource provides the contents of the given cursor shape in the
Xcursor theme.
If the given cursor shape is animated, ShapeCursorSource will keep
updating its content based on the value of current sprite's delay value.