From 7a5234a0cca2508b7a5ede1fc60dc3ae8b72a51c Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 29 Oct 2023 18:09:05 +0000 Subject: input: better cursor image infrastructure Improves handling of cursor images/surfaces Fixes an issue with decos and cursors Fixes #3471 --- src/render/Renderer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/render/Renderer.cpp') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 1e95c865..ea662867 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1940,11 +1940,23 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR void CHyprRenderer::setCursorSurface(wlr_surface* surf, int hotspotX, int hotspotY) { m_bCursorHasSurface = surf; + if (surf == m_sLastCursorData.surf) + return; + + m_sLastCursorData.name = ""; + m_sLastCursorData.surf = surf; + wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, surf, hotspotX, hotspotY); } void CHyprRenderer::setCursorFromName(const std::string& name) { m_bCursorHasSurface = true; + if (name == m_sLastCursorData.name) + return; + + m_sLastCursorData.name = name; + m_sLastCursorData.surf = nullptr; + wlr_cursor_set_xcursor(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sWLRXCursorMgr, name.c_str()); } -- cgit v1.2.3