wayland: Emit Cursor::changed signal when cursor surface is committed

The damaged signal is wired to the KWaylandServer::Cursor::changed
signal to indicate when the cursor image changes, makes sense.

But it can create issues if you repaint cursor SurfaceItem when the
SurfaceInterface::damaged signal is emitted. There might be other
signals that we need to wait for to invalidate SurfaceItem's state.

The SurfaceInterface::committed is a better signal. When it's emitted,
the surface commit has been completed. Technically, it's different from
the damaged signal, but in practice they are equivalent. GTK and Qt
always damage the cursor surface.
This commit is contained in:
Vlad Zahorodnii 2022-12-19 13:10:34 +02:00
parent a9174ad9a0
commit 877406ba50

View file

@ -345,11 +345,11 @@ void CursorPrivate::update(SurfaceInterface *s, quint32 serial, const QPoint &p)
} }
if (surface != s) { if (surface != s) {
if (!surface.isNull()) { if (!surface.isNull()) {
QObject::disconnect(surface.data(), &SurfaceInterface::damaged, q, &Cursor::changed); QObject::disconnect(surface.data(), &SurfaceInterface::committed, q, &Cursor::changed);
} }
surface = s; surface = s;
if (!surface.isNull()) { if (!surface.isNull()) {
QObject::connect(surface.data(), &SurfaceInterface::damaged, q, &Cursor::changed); QObject::connect(surface.data(), &SurfaceInterface::committed, q, &Cursor::changed);
} }
emitChanged = true; emitChanged = true;
Q_EMIT q->surfaceChanged(); Q_EMIT q->surfaceChanged();