From da8b7bcfcb3dda1360468bb32a1e1d5492f51f09 Mon Sep 17 00:00:00 2001 From: Mohab <133429578+MohabCodeX@users.noreply.github.com> Date: Wed, 10 Sep 2025 19:00:04 +0300 Subject: [PATCH 1/2] Improve cursor visibility handling in CResource::ShowCursor function --- Client/mods/deathmatch/logic/CResource.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Client/mods/deathmatch/logic/CResource.cpp b/Client/mods/deathmatch/logic/CResource.cpp index 57a6d61d6c1..a59b158ce95 100644 --- a/Client/mods/deathmatch/logic/CResource.cpp +++ b/Client/mods/deathmatch/logic/CResource.cpp @@ -410,10 +410,19 @@ void CResource::ShowCursor(bool bShow, bool bToggleControls) // Update our showing cursor state m_bShowingCursor = bShow; + } - // Show cursor if more than 0 resources wanting the cursor on - g_pCore->ForceCursorVisible(m_iShowingCursor > 0, bToggleControls); - g_pClientGame->SetCursorEventsEnabled(m_iShowingCursor > 0); + // Always update cursor and controls state when cursor should be visible + if (m_iShowingCursor > 0) + { + g_pCore->ForceCursorVisible(true, bToggleControls); + g_pClientGame->SetCursorEventsEnabled(true); + } + else + { + // Hide cursor if no resources want it visible + g_pCore->ForceCursorVisible(false, bToggleControls); + g_pClientGame->SetCursorEventsEnabled(false); } } From 9fe81ef671e74e630e08a2e6440a8186512591a9 Mon Sep 17 00:00:00 2001 From: Mohab <133429578+MohabCodeX@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:33:25 +0300 Subject: [PATCH 2/2] Refactor --- Client/mods/deathmatch/logic/CResource.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Client/mods/deathmatch/logic/CResource.cpp b/Client/mods/deathmatch/logic/CResource.cpp index a59b158ce95..d743dc5aa9a 100644 --- a/Client/mods/deathmatch/logic/CResource.cpp +++ b/Client/mods/deathmatch/logic/CResource.cpp @@ -412,18 +412,9 @@ void CResource::ShowCursor(bool bShow, bool bToggleControls) m_bShowingCursor = bShow; } - // Always update cursor and controls state when cursor should be visible - if (m_iShowingCursor > 0) - { - g_pCore->ForceCursorVisible(true, bToggleControls); - g_pClientGame->SetCursorEventsEnabled(true); - } - else - { - // Hide cursor if no resources want it visible - g_pCore->ForceCursorVisible(false, bToggleControls); - g_pClientGame->SetCursorEventsEnabled(false); - } + // Always update cursor and controls state regardless of cursor visibility change + g_pCore->ForceCursorVisible(m_iShowingCursor > 0, bToggleControls); + g_pClientGame->SetCursorEventsEnabled(m_iShowingCursor > 0); } SString CResource::GetResourceDirectoryPath(eAccessType accessType, const SString& strMetaPath)