# How to select on which monitor to display the game ?

**URL:** <https://forums.unrealengine.com/t/how-to-select-on-which-monitor-to-display-the-game/110390>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [May 3, 2018, 2:20pm UTC](https://forums.unrealengine.com/t/how-to-select-on-which-monitor-to-display-the-game/110390 "2018-05-03T14:20:31Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![alexpanter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alexpanter](https://forums.unrealengine.com/u/alexpanter)\
**Post date:** [February 29, 2024, 2:42pm UTC](https://forums.unrealengine.com/t/how-to-select-on-which-monitor-to-display-the-game/110390/11 "2024-02-29T14:42:16Z")

</div>

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:

> [@Mouse input is offset in UMG/Slate when the resolution/ViewportSize is changed at run-time (Standalone Game)](https://forums.unrealengine.com/t/mouse-input-is-offset-in-umg-slate-when-the-resolution-viewportsize-is-changed-at-run-time-standalone-game/328401/10):
>
> This is still a problem, i’d like to know as well

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_. 🙂

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:

```cpp
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.

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-select-on-which-monitor-to-display-the-game/110390)._
