How to select on which monitor to display the game ?

Thank you for the hints regarding ini file configs. I will try them out.

Regarding the issues I’m having, it could be an engine bug somewhere. It’s alluded here:

In particular:

Bumping this: from my testing it seems that this issue only occurs if you are using a second monitor? When I run my game on my main monitor, it behaves fine, but if I move it to my second monitor and start changing resolution, then the mouse gets super offset.

From what I can tell, whatever is in charge of mouse position uses the resolution of the first monitor, even when the game is running on a different one with a different resolution?

Maybe there’s a discrepancy between mouse coordinates in UMG and in the viewport. I’m not sure how to “frame” this correctly…

But it does seem like whenever the fullscreen window is moved to another screen with different DPI-scaling that the mouse coordinate system is not being updated properly.
I’m open to ideas how to approach this. For now I will continue to try stuff. :slight_smile:

Also, this issue only occurs when EWindowMode is Fullscreen. For WindowedFullscreen it works, for some reason.


Edit

After “trying stuff”, I have found this logic inside SlateApplication.cpp, seemingly suspicious:

FPointerEvent FSlateApplication::TransformPointerEvent(const FPointerEvent& PointerEvent, const TSharedPtr<SWindow>& Window) const
{
	FPointerEvent TransformedPointerEvent = PointerEvent;
	if (Window)
	{
		if (TransformFullscreenMouseInput && !GIsEditor && Window->GetWindowMode() == EWindowMode::Fullscreen)
		{
			// Screen space mapping scales everything. When window resolution doesn't match platform resolution, 
			// this causes offset cursor hit-tests in fullscreen. Correct in slate since we are first window-aware slate processor.
			FVector2f WindowSize = Window->GetSizeInScreen();
			FVector2f DisplaySize = { (float)CachedDisplayMetrics.PrimaryDisplayWidth, (float)CachedDisplayMetrics.PrimaryDisplayHeight };

			TransformedPointerEvent = FPointerEvent(PointerEvent, PointerEvent.GetScreenSpacePosition() * WindowSize / DisplaySize, PointerEvent.GetLastScreenSpacePosition() * WindowSize / DisplaySize);
		}
	}

	return TransformedPointerEvent;
}

If EWindowMode is Fullscreen, then no matter what the mouse position is offset by the PrimaryDisplay(Width|Height). This at least could explain why it works correctly for WindowedFullscreen. Exact same code is in FSlateApplication::LocateWidgetInWindow.

@Roy_Wierer.Seda145 do you think I’m on to something here? I’m not building the engine from source, so I can’t really change this. I could make a pull request somehow and get other people to review this. I have tried modifying the fields inside CachedDisplayMetrics to set primary display width/height to whatever is current window size, but unfortunately that didn’t solve the problem.