From 7f976199b71a27edcf28e6b1fe23b3075b05ee0c Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 3 Sep 2021 12:45:17 +0100 Subject: [PATCH] Adapt to kwayland-server icon changes The icon is a property of the active drag which is managed by Seat, the DataDevice should not cache this. --- src/pointer_input.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/pointer_input.cpp b/src/pointer_input.cpp index c4466fc8c0..beb5693a18 100644 --- a/src/pointer_input.cpp +++ b/src/pointer_input.cpp @@ -999,10 +999,8 @@ void CursorImage::markAsRendered() { if (m_currentSource == CursorSource::DragAndDrop) { // always sending a frame rendered to the drag icon surface to not freeze QtWayland (see https://bugreports.qt.io/browse/QTBUG-51599 ) - if (auto ddi = waylandServer()->seat()->dragSource()) { - if (const KWaylandServer::DragAndDropIcon *icon = ddi->icon()) { - icon->surface()->frameRendered(m_surfaceRenderedTimer.elapsed()); - } + if (const KWaylandServer::DragAndDropIcon *icon = waylandServer()->seat()->dragIcon()) { + icon->surface()->frameRendered(m_surfaceRenderedTimer.elapsed()); } } if (m_currentSource != CursorSource::LockScreen @@ -1184,13 +1182,11 @@ void CursorImage::updateDragCursor() m_drag.cursor = {}; const bool needsEmit = m_currentSource == CursorSource::DragAndDrop; QImage additionalIcon; - if (auto ddi = waylandServer()->seat()->dragSource()) { - if (const KWaylandServer::DragAndDropIcon *dragIcon = ddi->icon()) { - if (auto buffer = qobject_cast(dragIcon->surface()->buffer())) { - additionalIcon = buffer->data().copy(); - additionalIcon.setDevicePixelRatio(dragIcon->surface()->bufferScale()); - additionalIcon.setOffset(dragIcon->position()); - } + if (const KWaylandServer::DragAndDropIcon *dragIcon = waylandServer()->seat()->dragIcon()) { + if (auto buffer = qobject_cast(dragIcon->surface()->buffer())) { + additionalIcon = buffer->data().copy(); + additionalIcon.setDevicePixelRatio(dragIcon->surface()->bufferScale()); + additionalIcon.setOffset(dragIcon->position()); } } auto p = waylandServer()->seat()->pointer();