Issues with window sizes on multiple monitors

Steps to Reproduce

I was able to recreate the issue in a new 5.4 project with the following steps:

  • Connect an additional monitor with a different resolution than the main one
  • Create a C++ function with the below code to spawn an additional slate window
    • The class and name of the function can be whatever, but make sure the function accepts two vectors, one for window size and one for window position
  • Hard-code a vector size and pixel position for the window to be spawned
    • You can use any method to determine what pixel coordinates would place the window’s upper left corner on the second monitor, I personally used a screen capture and a photo editor. Any position and size will do so long as it’s fully on the second monitor.
  • Create a simple BP call to that C++ function, passing in the previously determined size and screen position. Hook that call into a key press, etc so it can be used in Play mode
  • Run the editor on the primary (first) monitor
  • Spawn the new window on the second monitor. The second window should spawn in at the correct position, but with the incorrect size.
  • The log prints in the C++ function can further detail how the size changed between steps

*Note: I’ve omitted the code related to the viewport since I didn’t think it was relevant, but I can provide the full C++ function if requested.

`//ExtraWindow is just a TSharedPtr variable initialized to nullptr
//InitialSizeInScreen and InitialPositionInScreen are function inputs

UE_LOG(LogTemp, Warning, TEXT(“Size before SAssignNew: %s”), *InitialSizeInScreen.ToString()); //this size is correct
SAssignNew(ExtraWindow, SWindow)
.SizingRule(ESizingRule::UserSized)
.UserResizeBorder(FMargin(3.0f, 3.0f))
.Cursor(EMouseCursor::Default)
.bDragAnywhere(true)
.SaneWindowPlacement(true)
.LayoutBorder(FMargin(3.0f, 3.0f))
.Type(EWindowType::GameWindow)
.Title(WindowTitle)
.CreateTitleBar(false)
.UseOSWindowBorder(true)
.FocusWhenFirstShown(false)
.ClientSize(InitialSizeInScreen)
.ScreenPosition(InitialPositionInScreen);
UE_LOG(LogTemp, Warning, TEXT(“Size after SAssignNew: %s”), *ExtraWindow->GetSizeInScreen().ToString()); //this size is not`