Hi,
Unreal 5.0.3, Linux.
I’m working on plugin which will detect some OS parameters and modify main app. My HW has 3 displays and we want to choose where to place app by display ID/index.
First attempt ended with
UGameViewportClient* viewportClient = GEngine->GameViewport;
if (viewportClient)
{
TSharedPtr<SWindow> slateWindow = viewportClient->GetWindow();
if (slateWindow)
{
TSharedPtr<FGenericWindow> nativeWindow = slateWindow->GetNativeWindow();
FDisplayMetrics DisplayMetrics;
FSlateApplication::Get().GetDisplayMetrics(DisplayMetrics);
if (MonitorIndex < 0 || MonitorIndex>=DisplayMetrics.MonitorInfo.Num())
{
UE_LOG( LogTemp, Warning, TEXT("=> Incorrect monitor index (%d)"), MonitorIndex);
return;
}
const FMonitorInfo & MonitorInfo = DisplayMetrics.MonitorInfo[MonitorIndex];
nativeWindow->SetWindowMode(EWindowMode::Windowed);
nativeWindow->MoveWindowTo(MonitorInfo.DisplayRect.Left, MonitorInfo.DisplayRect.Top);
nativeWindow->SetWindowMode(EWindowMode::WindowedFullscreen);
}
}
Without changing window mode Fullscreen->WIndow->Fullscreen this doesn’t move game window where I want it. And some slight flicker is visible. I would like to avoid it.
Second idea is to dynamically change FCommandLine to add WinX and WinY with above acquired positions and let GameEngine create GameWindow already where I want it to be.
But I’m unable to modify FCommandLine (with Get()/Set() or Append()) in a way that it would be visible to GameEngine class.
Is it possible?
I would welcome any tips to solve this problem.