From 9b3925009aaacc236a4ed6ea91c0d1e157f2ca0a Mon Sep 17 00:00:00 2001 From: nyx Date: Sun, 6 Apr 2025 17:24:14 -0400 Subject: [PATCH] DataDevice: position icon at cursor hotspot (#9895) * DataDevice: position icon at cursor hotspot ref: https://wayland.app/protocols/wayland#wl_data_device:request:start_drag --- src/protocols/core/DataDevice.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index f4044ec5..83226e3a 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -808,15 +808,19 @@ void CWLDataDeviceProtocol::renderDND(PHLMONITOR pMonitor, timespec* when) { const auto POS = g_pInputManager->getMouseCoordsInternal(); - CBox box = CBox{POS, dnd.dndSurface->current.size}.translate(-pMonitor->vecPosition + g_pPointerManager->cursorSizeLogical() / 2.F).scale(pMonitor->scale); + Vector2D surfacePos = POS; + + surfacePos += dnd.dndSurface->current.offset; + + CBox box = CBox{surfacePos, dnd.dndSurface->current.size}.translate(-pMonitor->vecPosition).scale(pMonitor->scale); CTexPassElement::SRenderData data; data.tex = dnd.dndSurface->current.texture; data.box = box; g_pHyprRenderer->m_sRenderPass.add(makeShared(data)); - box = CBox{POS, dnd.dndSurface->current.size}.translate(g_pPointerManager->cursorSizeLogical() / 2.F).expand(5); - g_pHyprRenderer->damageBox(box); + CBox damageBox = CBox{surfacePos, dnd.dndSurface->current.size}.expand(5); + g_pHyprRenderer->damageBox(damageBox); dnd.dndSurface->frame(when); }