From 877406ba504560d27d4590db536a07943016009f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 19 Dec 2022 13:10:34 +0200 Subject: [PATCH] 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. --- src/wayland/pointer_interface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wayland/pointer_interface.cpp b/src/wayland/pointer_interface.cpp index f7c64433f3..a85cd31666 100644 --- a/src/wayland/pointer_interface.cpp +++ b/src/wayland/pointer_interface.cpp @@ -345,11 +345,11 @@ void CursorPrivate::update(SurfaceInterface *s, quint32 serial, const QPoint &p) } if (surface != s) { if (!surface.isNull()) { - QObject::disconnect(surface.data(), &SurfaceInterface::damaged, q, &Cursor::changed); + QObject::disconnect(surface.data(), &SurfaceInterface::committed, q, &Cursor::changed); } surface = s; if (!surface.isNull()) { - QObject::connect(surface.data(), &SurfaceInterface::damaged, q, &Cursor::changed); + QObject::connect(surface.data(), &SurfaceInterface::committed, q, &Cursor::changed); } emitChanged = true; Q_EMIT q->surfaceChanged();