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
This commit is contained in:
nyx
2025-04-06 17:24:14 -04:00
committed by GitHub
parent 3c128679ee
commit 9b3925009a

View File

@@ -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<CTexPassElement>(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);
}