From e5eb1bdf01013728293f4bf930dce81f1ebd366f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Silva?= <123550+andresilva@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:48:48 +0000 Subject: [PATCH] renderer: ignore set cursor surface if cursor should be hidden (#4780) --- src/render/Renderer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 863279ac..235c3f6f 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -2152,7 +2152,7 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR void CHyprRenderer::setCursorSurface(wlr_surface* surf, int hotspotX, int hotspotY, bool force) { m_bCursorHasSurface = surf; - if ((surf == m_sLastCursorData.surf || m_bCursorHidden) && hotspotX == m_sLastCursorData.hotspotX && hotspotY == m_sLastCursorData.hotspotY && !force) + if (surf == m_sLastCursorData.surf && hotspotX == m_sLastCursorData.hotspotX && hotspotY == m_sLastCursorData.hotspotY && !force) return; m_sLastCursorData.name = ""; @@ -2160,18 +2160,24 @@ void CHyprRenderer::setCursorSurface(wlr_surface* surf, int hotspotX, int hotspo m_sLastCursorData.hotspotX = hotspotX; m_sLastCursorData.hotspotY = hotspotY; + if (m_bCursorHidden && !force) + return; + wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, surf, hotspotX, hotspotY); } void CHyprRenderer::setCursorFromName(const std::string& name, bool force) { m_bCursorHasSurface = true; - if ((name == m_sLastCursorData.name || m_bCursorHidden) && !force) + if (name == m_sLastCursorData.name && !force) return; m_sLastCursorData.name = name; m_sLastCursorData.surf.reset(); + if (m_bCursorHidden && !force) + return; + wlr_cursor_set_xcursor(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sWLRXCursorMgr, name.c_str()); }