Viewport Size vs. GSystemResolution

Hi all:

I’ve used both Viewport->GetSizeXY() and GSystemResolution, and have found that:

  1. GSystemResolution will return the project’s standard resolution, no matter what the viewport size
  2. GetSizeXY() returns something CLOSER to the actual viewport size, but slightly bigger (see below)

As an example, if I run a game at 1280 x 720, #1 will return (1280x720) where as #2 will return (1290x754). Please note that GetSizeXY() is 10 pixels wider and 34 pixels taller. I’m assuming this is due to the Windows borders and title bar.

My question is, is there a way to get the Viewport space without having the Windows border elements added to the dimensions? I’m using #1 for the time being, but GetSizeXY() seems more flexible in that it will automatically adjust to the actual dimensions used in the Editor, etc.

Thank you,

p.s. Quick sample code for measuring your own screensize (so that others can see what I mean):

myController = Cast<APlayerController>(UGameplayStatics::GetPlayerController(this->GetWorld(), 0));
viewPortSize = this->GetWorld()->GetGameViewport()->Viewport->GetSizeXY();
UE_LOG(LogTemp, Warning, TEXT("Viewport X- %i   Y- %i"), viewPortSize.X, viewPortSize.Y);
UE_LOG(LogTemp, Error, TEXT("Resolution X- %i   Y- %i"), GSystemResolution.ResX, GSystemResolution.ResY);