mirror of
https://github.com/Ed94/Cog.git
synced 2026-07-31 20:00:07 +00:00
CogImGui: Fix cursor hidden on startup if imgui input is enabled
This commit is contained in:
@@ -100,7 +100,6 @@ void FCogImguiContext::Initialize()
|
|||||||
PlatformApplication->OnDisplayMetricsChanged().AddRaw(this, &FCogImguiContext::OnDisplayMetricsChanged);
|
PlatformApplication->OnDisplayMetricsChanged().AddRaw(this, &FCogImguiContext::OnDisplayMetricsChanged);
|
||||||
OnDisplayMetricsChanged(DisplayMetrics);
|
OnDisplayMetricsChanged(DisplayMetrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
@@ -640,6 +639,19 @@ void FCogImguiContext::SetShareMouseWithGameplay(bool Value)
|
|||||||
//--------------------------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------------------------
|
||||||
void FCogImguiContext::RefreshMouseCursor()
|
void FCogImguiContext::RefreshMouseCursor()
|
||||||
{
|
{
|
||||||
|
//-------------------------------------------------------------------------------------------
|
||||||
|
// Focus the main widget when enabling input otherwise the mouse can still be hidden because
|
||||||
|
// the gameplay might have the focus and might hide the cursor.
|
||||||
|
//-------------------------------------------------------------------------------------------
|
||||||
|
if (bEnableInput)
|
||||||
|
{
|
||||||
|
FSlateApplication::Get().SetKeyboardFocus(MainWidget);
|
||||||
|
FSlateApplication::Get().SetUserFocus(0, MainWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------
|
||||||
|
// Force to show the cursor when sharing mouse with gameplay for games that hide the cursor
|
||||||
|
//-------------------------------------------------------------------------------------------
|
||||||
if (APlayerController* PlayerController = GetLocalPlayerController(GameViewport->GetWorld()))
|
if (APlayerController* PlayerController = GetLocalPlayerController(GameViewport->GetWorld()))
|
||||||
{
|
{
|
||||||
if (bHasSavedInitialCursorVisibility == false)
|
if (bHasSavedInitialCursorVisibility == false)
|
||||||
|
|||||||
Reference in New Issue
Block a user