CogImGui: Fix cursor hidden on startup if imgui input is enabled
This commit is contained in:
1 parent
56bb628792
commit
b2bb2a4de0
1 file changed
+13
-1
@@ -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