Revert setmousevisibility showcursor change. Old piemenu showcursor code fixed.

This commit is contained in:
pierow 2021-02-03 23:15:38 -05:00
parent 086c9a4aa6
commit d4d05b21c5
2 changed files with 31 additions and 15 deletions

View file

@ -123,7 +123,8 @@ void AvHPieMenuHandler::ClosePieMenu(void)
IN_ResetMouse();
gHUD.ShowCrosshair();
sPieMenuOpen = false;
// 2021 - moved to InternalClosePieMenu for ShowCursor fix.
//sPieMenuOpen = false;
}
@ -137,6 +138,12 @@ void AvHPieMenuHandler::InternalClosePieMenu(void)
if(!gHUD.GetInTopDownMode())
{
gHUD.GetManager().SetMouseVisibility(false);
// OS cursor displaying over in game cursor fix. Remove if showcursor code in SetMouseVisibility is made bug free.
#ifdef WIN32
if(sPieMenuOpen)
ShowCursor(TRUE);
#endif
}
theMarineMenu->SetFadeState(false);
@ -146,6 +153,7 @@ void AvHPieMenuHandler::InternalClosePieMenu(void)
}
sLastNodeHighlighted = NULL;
// Return to raw input after menu closes
if (CVAR_GET_FLOAT("m_rawinput") != 0)
{
SDL_SetRelativeMouseMode(SDL_TRUE);
@ -160,7 +168,7 @@ void AvHPieMenuHandler::InternalClosePieMenu(void)
// }
// }
}
sPieMenuOpen = false;
}
void AvHPieMenuHandler::OpenPieMenu(void)
@ -181,18 +189,21 @@ void AvHPieMenuHandler::OpenPieMenu(void)
if(!gHUD.GetInTopDownMode())
{
gHUD.GetManager().SetMouseVisibility(true);
// OS cursor displaying over in game cursor fix. Remove if showcursor code in SetMouseVisibility is made bug free.
#ifdef WIN32
ShowCursor(FALSE);
#endif
}
gHUD.HideCrosshair();
// Workaround for not being able to center mouse with raw input enabled.
if (CVAR_GET_FLOAT("m_rawinput") != 0)
{
SDL_SetRelativeMouseMode(SDL_FALSE);
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
}
//App::getInstance()->setCursorOveride(App::getInstance()->getScheme()->getCursor(Scheme::scu_none));
//App::getInstance()->setCursorOveride(gHUD.GetManager().mBlankCursor);
// Only do this when in full screen
//App::getInstance()->setCursorPos(ScreenWidth/2, ScreenHeight/2);

View file

@ -307,13 +307,16 @@ void UIManager::SetMouseVisibility(bool inState)
//App::getInstance()->setCursorOveride(App::getInstance()->getScheme()->getCursor(Scheme::SchemeCursor::scu_arrow));
// Remove above line and put this line back in for sprite cursors
App::getInstance()->setCursorOveride(this->mBlankCursor);
#ifdef WIN32
// 2021 - Prevent windows OS cursor from appearing over sprite cursor.
// Uncomment below to track windows showcursor value because you can only increment or decrement by 1 with no min or max on the value so it can get stuck in a high or low range.
// If the cursor breaks, create a for loop to increment or decrement the value as necessary to fix it. https://devblogs.microsoft.com/oldnewthing/20091217-00/?p=15643
/*int sc = */ShowCursor(FALSE);
//gEngfuncs.Con_Printf("showcursor:%d\n", sc);
#endif
// OS cursor show/hide fix for m_rawinput 0. Disabled until we can find a way to check if options menu is open. Otherwise cursor is hidden in options menu when commanding or spectating.
// If uncommenting this, remove Showcursor code in PieMenuHandler.
//#ifdef WIN32
// // 2021 - Prevent windows OS cursor from appearing over sprite cursor.
// // Uncomment below to track windows showcursor value because you can only increment or decrement by 1 with no min or max on the value so it can get stuck in a high or low range.
// // If the cursor breaks, create a for loop to increment or decrement the value as necessary to fix it. https://devblogs.microsoft.com/oldnewthing/20091217-00/?p=15643
// /*int sc = */ShowCursor(FALSE);
// //gEngfuncs.Con_Printf("showcursor:%d\n", sc);
//#endif
}
else
{
@ -325,9 +328,11 @@ void UIManager::SetMouseVisibility(bool inState)
// Hide cursor again
App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::scu_none) );
#ifdef WIN32
ShowCursor(TRUE);
#endif
// OS cursor show/hide fix for m_rawinput 0.
//#ifdef WIN32
// ShowCursor(TRUE);
//#endif
}
//App::getInstance()->setCursorOveride( App::getInstance()->getScheme()->getCursor(Scheme::SchemeCursor::scu_none) );