WindowPosition
WindowPosition
#Overview
name: WindowPosition
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 35
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of WindowPosition is to determine and control the position of windows within the Unreal Engine user interface. It is primarily used for placing and managing various windows, dialogs, and UI elements in the editor and game viewport.
Key points about WindowPosition:
-
It is used by multiple Unreal Engine subsystems, including the editor, rendering system, and various plugins.
-
The value is typically set when creating or positioning windows, often calculated based on the display metrics and desired placement (e.g., centered, at a specific screen coordinate).
-
It interacts with other variables like WindowSize, DisplaySize, and DPIScale to ensure proper window placement and scaling across different monitor setups.
-
The variable is used in both the editor (for tool windows, import dialogs, etc.) and in-game (for PIE windows, debug consoles, etc.).
-
Developers should be aware that WindowPosition is affected by DPI scaling and multi-monitor setups. Proper handling of these scenarios is important for a consistent user experience.
-
Best practices include:
- Using engine-provided functions for window placement when possible.
- Considering DPI scaling when manually setting window positions.
- Ensuring windows are placed within visible screen areas.
- Saving and restoring window positions for persistent UI elements.
-
Special considerations:
- Window positions may need to be adjusted for different display configurations.
- Some windows may have specific placement requirements (e.g., centered, relative to other windows).
- Developers should handle cases where the desired position is outside the visible screen area.
In summary, WindowPosition is a crucial variable for managing UI layout in Unreal Engine, and proper usage ensures a polished and consistent user interface across different systems and display configurations.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:552, section: [UnrealEd.UIEditorOptions]
- INI Section:
UnrealEd.UIEditorOptions
- Raw value:
(X=256,Y=256,Width=1024,Height=768)
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Animation/RigLogic/Source/RigLogicEditor/Private/DNAImporter.cpp:90
Scope (from outer to inner):
file
function FDNAAssetImportOptions* GetImportOptions
Source code excerpt:
DNAImportWindowSize *= ScaleFactor;
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - DNAImportWindowSize) / 2.0f) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(NSLOCTEXT("UnrealEd", "DNAImportOpionsTitle", "DNA Import Options"))
.SizingRule(ESizingRule::Autosized)
.AutoCenter(EAutoCenter::None)
.ClientSize(DNAImportWindowSize)
.ScreenPosition(WindowPosition);
TSharedPtr<SDNAAssetImportWindow> DNAImportWindow;
Window->SetContent
(
SAssignNew(DNAImportWindow, SDNAAssetImportWindow)
.ImportUI(ImportUI)
#Loc: <Workspace>/Engine/Plugins/Experimental/Avalanche/Source/AvalancheLevelViewport/Private/SAvaLevelViewportFrame.cpp:156
Scope (from outer to inner):
file
function void SAvaLevelViewportFrame::Tick
Source code excerpt:
if (TSharedPtr<SWindow> Window = FSlateApplication::Get().FindWidgetWindow(ViewportWidget.ToSharedRef()))
{
const FVector2f WindowPosition = Window->GetPositionInScreen();
MousePosition -= WindowPosition;
ViewportPosition -= WindowPosition;
}
if (HorizontalRuler.IsValid())
{
HorizontalRuler->SetCursor(static_cast<FVector2D>(MousePosition));
HorizontalRuler->SetRuling(static_cast<FVector2D>(ViewportPosition), UnitScale.X);
#Loc: <Workspace>/Engine/Plugins/Experimental/HairCardGenerator/Source/HairCardGeneratorEditor/Private/HairCardGenOptionsWindow.cpp:256
Scope (from outer to inner):
file
function bool HairCardGenWindow_Utils::PromptUserWithHairCardGenDialog
Source code excerpt:
WindowSize *= ScaleFactor;
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - WindowSize) / 2.0f) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(LOCTEXT("HairCardSettings.Title", "Card Generation Settings"))
.SizingRule(ESizingRule::UserSized)
.AutoCenter(EAutoCenter::None)
.ClientSize(WindowSize)
.ScreenPosition(WindowPosition);
TSharedPtr<SHairCardGenOptionsWindow> HairCardGenWindow;
Window->SetContent
(
SAssignNew(HairCardGenWindow, SHairCardGenOptionsWindow)
.SettingsObject(SettingsObject)
#Loc: <Workspace>/Engine/Plugins/Experimental/HairCardGenerator/Source/HairCardGeneratorEditor/Private/HairCardGenOptionsWindow.cpp:1020
Scope (from outer to inner):
file
function static bool HairCardGenWindow_Impl::PromptGroupSettingsDialog
Source code excerpt:
WindowSize *= ScaleFactor;
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - WindowSize) / 2.0f) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(LOCTEXT("HairCardSettings.Group.Title", "Card Group Settings"))
.SizingRule(ESizingRule::Autosized)
.AutoCenter(EAutoCenter::None)
.ClientSize(WindowSize)
.ScreenPosition(WindowPosition);
TSharedPtr<SHairCardGroupSettingsWindow> GroupSettingsOptionsWindow;
Window->SetContent
(
SAssignNew(GroupSettingsOptionsWindow, SHairCardGroupSettingsWindow)
.FilterGroupIndex(FilterGroupIndex)
#Loc: <Workspace>/Engine/Plugins/Interchange/Runtime/Source/Pipelines/Private/InterchangePipelineHelper.cpp:27
Scope (from outer to inner):
file
namespace UE::Interchange::PipelineHelper
function void ShowModalDialog
Source code excerpt:
FbxImportWindowSize *= ScaleFactor;
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - FbxImportWindowSize) / 2.0f) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(Title)
.SizingRule(ESizingRule::UserSized)
.AutoCenter(EAutoCenter::None)
.ClientSize(FbxImportWindowSize)
.ScreenPosition(WindowPosition);
ConflictWidget->SetWidgetWindow(Window);
Window->SetContent
(
ConflictWidget
);
#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingEditor/Private/PixelStreamingVideoInputBackBufferComposited.cpp:191
Scope (from outer to inner):
file
function void FPixelStreamingVideoInputBackBufferComposited::CompositeWindows
Source code excerpt:
{
FIntPoint TextureExtent = VectorMin(CurrentWindow.GetTexture()->GetDesc().Extent, CurrentWindow.GetSizeInScreen().IntPoint());
FIntPoint WindowPosition = FIntPoint(CurrentWindow.GetPositionInScreen().X, CurrentWindow.GetPositionInScreen().Y);
// Update the top left to be the element-wise minimum
TopLeft = VectorMin(TopLeft, WindowPosition);
// Update the bottom right to be the element-wise maximum
BottomRight = VectorMax(BottomRight, (WindowPosition + TextureExtent));
}
// Shader globals used in the conversion pass
FGlobalShaderMap* GlobalShaderMap = GetGlobalShaderMap(GMaxRHIFeatureLevel);
TShaderMapRef<FScreenPassVS> VertexShader(GlobalShaderMap);
#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingEditor/Private/PixelStreamingVideoInputBackBufferComposited.cpp:218
Scope (from outer to inner):
file
function void FPixelStreamingVideoInputBackBufferComposited::CompositeWindows
Source code excerpt:
for (FTexturedWindow& CurrentWindow : TopLevelWindows)
{
FIntPoint WindowPosition = FIntPoint(CurrentWindow.GetPositionInScreen().X, CurrentWindow.GetPositionInScreen().Y) - TopLeft;
FRHITexture* CurrentTexture = CurrentWindow.GetTexture()->GetRHI();
FRDGTextureRef InputTexture = GraphBuilder.RegisterExternalTexture(CreateRenderTarget(CurrentTexture, TEXT("VideoInputBackBufferCompositedStaging")));
// There is only ever one tooltip and as such UE keeps the same texture for each and just rerenders the
// content this can lead to small tooltips having a large texture from a previously displayed long tooltip
#Loc: <Workspace>/Engine/Plugins/Media/PixelStreaming/Source/PixelStreamingEditor/Private/PixelStreamingVideoInputBackBufferComposited.cpp:236
Scope (from outer to inner):
file
function void FPixelStreamingVideoInputBackBufferComposited::CompositeWindows
Source code excerpt:
// Configure our viewports appropriately
FScreenPassTextureViewport InputViewport(InputTexture, FIntRect(FIntPoint(0, 0), Extent));
FScreenPassTextureViewport OutputViewport(CompositedTexture, FIntRect(WindowPosition, WindowPosition + Extent));
// Rectangle area to use from the source texture
const FIntRect ViewRect(FIntPoint(0, 0), Extent);
// Dummy ViewFamily/ViewInfo created to use built in Draw Screen/Texture Pass
FSceneViewFamilyContext ViewFamily(FSceneViewFamily::ConstructionValues(nullptr, nullptr, FEngineShowFlags(ESFIM_Game))
#Loc: <Workspace>/Engine/Plugins/Runtime/Synthesis/Source/Synthesis/Private/UI/SSynthTooltip.cpp:45
Scope (from outer to inner):
file
function void SSynthTooltip::SetWindowContainerVisibility
Source code excerpt:
{
bIsVisible = true;
WindowContainer->MoveWindowTo(WindowPosition);
WindowContainer->ShowWindow();
}
else if (!bShowVisibility && bIsVisible)
{
bIsVisible = false;
WindowContainer->HideWindow();
#Loc: <Workspace>/Engine/Plugins/Runtime/Synthesis/Source/Synthesis/Private/UI/SSynthTooltip.cpp:58
Scope (from outer to inner):
file
function void SSynthTooltip::SetOverlayWindowPosition
Source code excerpt:
void SSynthTooltip::SetOverlayWindowPosition(FVector2D Position)
{
WindowPosition = Position;
WindowContainer->MoveWindowTo(WindowPosition);
}
void SSynthTooltip::SetOverlayText(const FText& InText)
{
if (TooltipText.IsValid())
{
#Loc: <Workspace>/Engine/Plugins/Runtime/Synthesis/Source/Synthesis/Public/UI/SSynthTooltip.h:25
Scope (from outer to inner):
file
class class SSynthTooltip : public SOverlay
Source code excerpt:
TSharedPtr<SWindow> WindowContainer;
TSharedPtr<STextBlock> TooltipText;
FVector2D WindowPosition;
bool bIsVisible;
};
#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_2
#include "CoreMinimal.h"
#Loc: <Workspace>/Engine/Plugins/Runtime/nDisplay/Source/DisplayClusterConfigurator/Private/ClusterConfiguration/DisplayClusterConfiguratorClusterEditorUtils.cpp:334
Scope (from outer to inner):
file
function void UE::DisplayClusterConfiguratorClusterEditorUtils::ShowNewClusterItemDialogWindow
Source code excerpt:
const FVector2D DialogWindowSize = WindowSize * ScaleFactor;
const FVector2D WindowPosition = (DisplayTopLeft + 0.5f * (DisplaySize - DialogWindowSize)) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(WindowTitle)
.SizingRule(ESizingRule::Autosized)
.AutoCenter(EAutoCenter::None)
.ClientSize(DialogWindowSize)
.ScreenPosition(WindowPosition);
DialogContent->SetParentWindow(Window);
Window->SetContent(DialogContent);
FSlateApplication::Get().AddModalWindow(Window, ParentWindow, false);
}
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/DMX/DMXEngine/Source/DMXEditor/Private/Factories/DMXGDTFImporter.cpp:652
Scope (from outer to inner):
file
function void FDMXGDTFImporter::GetImportOptions
Source code excerpt:
FVector2D DisplaySize(WorkAreaRect.Right - WorkAreaRect.Left, WorkAreaRect.Bottom - WorkAreaRect.Top);
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - ImportWindowSize) / 2.0f);
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(LOCTEXT("GDTFImportOpionsTitle", "GDTF Import Options"))
.SizingRule(ESizingRule::Autosized)
.AutoCenter(EAutoCenter::None)
.ClientSize(ImportWindowSize)
.ScreenPosition(WindowPosition);
TSharedPtr<SDMXGDTFOptionWindow> OptionWindow;
Window->SetContent
(
SAssignNew(OptionWindow, SDMXGDTFOptionWindow)
.ImportUI(ImportUI)
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/DMX/DMXEngine/Source/DMXEditor/Private/Factories/DMXLibraryFromMVRImporter.cpp:85
Scope (from outer to inner):
file
namespace UE::DMX::DMXLibraryFromMVRImporter::Private
class class FDMXLibraryFromMVROptionsWindow
function FDMXLibraryFromMVROptionsWindow
Source code excerpt:
const FVector2D DisplaySize(WorkAreaRect.Right - WorkAreaRect.Left, WorkAreaRect.Bottom - WorkAreaRect.Top);
const FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - WindowSize) / 2.0f);
const FText Caption = InOptions->bIsReimport ?
LOCTEXT("ReimportWindowCaption", "MVR Reimport Options") :
LOCTEXT("ImportWindowCaption", "MVR Import Options");
const TSharedRef<SWindow> Window = SNew(SWindow)
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/DMX/DMXEngine/Source/DMXEditor/Private/Factories/DMXLibraryFromMVRImporter.cpp:96
Scope (from outer to inner):
file
namespace UE::DMX::DMXLibraryFromMVRImporter::Private
class class FDMXLibraryFromMVROptionsWindow
function FDMXLibraryFromMVROptionsWindow
Source code excerpt:
.AutoCenter(EAutoCenter::None)
.ClientSize(WindowSize)
.ScreenPosition(WindowPosition);
Window->SetContent
(
SNew(SDMXLibraryFromMVRImportOptions, Window, InOptions)
.MaxWidgetSize(WindowPosition)
);
FSlateApplication::Get().AddModalWindow(Window, ParentWindow, false);
}
};
}
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/LevelSnapshots/Source/LevelSnapshotsEditor/Private/Widgets/SLevelSnapshotsEditorCreationForm.cpp:57
Scope (from outer to inner):
file
function TSharedRef<SWindow> SLevelSnapshotsEditorCreationForm::MakeAndShowCreationWindow
Source code excerpt:
const FVector2D DisplaySize(WorkAreaRect.Right - WorkAreaRect.Left, WorkAreaRect.Bottom - WorkAreaRect.Top);
const FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - BaseWindowSize) / 2.0f);
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(NSLOCTEXT("LevelSnapshots", "LevelSnapshots_CreationForm_Title", "Create Level Snapshot"))
.SizingRule(ESizingRule::UserSized)
.AutoCenter(EAutoCenter::PrimaryWorkArea)
.ClientSize(BaseWindowSize)
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/LevelSnapshots/Source/LevelSnapshotsEditor/Private/Widgets/SLevelSnapshotsEditorCreationForm.cpp:67
Scope (from outer to inner):
file
function TSharedRef<SWindow> SLevelSnapshotsEditorCreationForm::MakeAndShowCreationWindow
Source code excerpt:
.SupportsMinimize(false)
.SupportsMaximize(false)
.ScreenPosition(WindowPosition);
const TSharedRef<SLevelSnapshotsEditorCreationForm> CreationForm = SNew(SLevelSnapshotsEditorCreationForm, Window, CallOnClose);
Window->SetContent
(
CreationForm
);
#Loc: <Workspace>/Engine/Source/Editor/FoliageEdit/Private/FoliageEdMode.cpp:4065
Scope (from outer to inner):
file
function void FFoliageUISettings::Load
Source code excerpt:
{
FString WindowPositionString;
if (GConfig->GetString(TEXT("FoliageEdit"), TEXT("WindowPosition"), WindowPositionString, GEditorPerProjectIni))
{
TArray<FString> PositionValues;
if (WindowPositionString.ParseIntoArray(PositionValues, TEXT(","), true) == 4)
{
WindowX = FCString::Atoi(*PositionValues[0]);
WindowY = FCString::Atoi(*PositionValues[1]);
#Loc: <Workspace>/Engine/Source/Editor/FoliageEdit/Private/FoliageEdMode.cpp:4107
Scope (from outer to inner):
file
function void FFoliageUISettings::Save
Source code excerpt:
{
FString WindowPositionString = FString::Printf(TEXT("%d,%d,%d,%d"), WindowX, WindowY, WindowWidth, WindowHeight);
GConfig->SetString(TEXT("FoliageEdit"), TEXT("WindowPosition"), *WindowPositionString, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("FoliageEdit"), TEXT("Radius"), Radius, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("FoliageEdit"), TEXT("PaintDensity"), PaintDensity, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("FoliageEdit"), TEXT("UnpaintDensity"), UnpaintDensity, GEditorPerProjectIni);
GConfig->SetBool(TEXT("FoliageEdit"), TEXT("bFilterLandscape"), bFilterLandscape, GEditorPerProjectIni);
GConfig->SetBool(TEXT("FoliageEdit"), TEXT("bFilterStaticMesh"), bFilterStaticMesh, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/PIEPreviewDeviceProfileSelector/Private/PIEPreviewWindow.h:21
Scope (from outer to inner):
file
class class SPIEPreviewWindow : public SWindow
Source code excerpt:
// call this function set the 'preview device' and set initial values for the position and resolution scaling factor
void PrepareWindow(FVector2D WindowPosition, const float InitialScaleFactor, TSharedPtr<FPIEPreviewDevice> PreviewDevice);
// call this function to perform cleanup
void PrepareShutdown();
// retrieves the display device
TSharedPtr<class FPIEPreviewDevice> GetDevice();
#Loc: <Workspace>/Engine/Source/Editor/SparseVolumeTexture/Private/SparseVolumeTextureFactory.cpp:337
Scope (from outer to inner):
file
function static bool ShowOpenVDBImportWindow
Source code excerpt:
ImportWindowSize *= ScaleFactor;
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - ImportWindowSize) / 2.0f) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(NSLOCTEXT("UnrealEd", "OpenVDBImportOptionsTitle", "OpenVDB Import Options"))
.SizingRule(ESizingRule::Autosized)
.AutoCenter(EAutoCenter::None)
.ClientSize(ImportWindowSize)
.ScreenPosition(WindowPosition);
TArray<TSharedPtr<ESparseVolumeAttributesFormat>> SupportedFormats =
{
MakeShared<ESparseVolumeAttributesFormat>(ESparseVolumeAttributesFormat::Float32),
MakeShared<ESparseVolumeAttributesFormat>(ESparseVolumeAttributesFormat::Float16),
MakeShared<ESparseVolumeAttributesFormat>(ESparseVolumeAttributesFormat::Unorm8)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Fbx/FbxMainImport.cpp:232
Scope (from outer to inner):
file
namespace UnFbx
function FBXImportOptions* GetImportOptions
Source code excerpt:
FbxImportWindowSize *= ScaleFactor;
FVector2D WindowPosition = (DisplayTopLeft + (DisplaySize - FbxImportWindowSize) / 2.0f) / ScaleFactor;
TSharedRef<SWindow> Window = SNew(SWindow)
.Title(NSLOCTEXT("UnrealEd", "FBXImportOpionsTitle", "FBX Import Options"))
.SizingRule(ESizingRule::Autosized)
.AutoCenter(EAutoCenter::None)
.ClientSize(FbxImportWindowSize)
.ScreenPosition(WindowPosition);
TSharedPtr<SFbxOptionWindow> FbxOptionWindow;
Window->SetContent
(
SAssignNew(FbxOptionWindow, SFbxOptionWindow)
.ImportUI(ImportUI)
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:3259
Scope (from outer to inner):
file
function TSharedRef<SPIEViewport> UEditorEngine::GeneratePIEViewportWindow
Source code excerpt:
TSharedRef<SPIEViewport> UEditorEngine::GeneratePIEViewportWindow(const FRequestPlaySessionParams& InSessionParams, int32 InViewportIndex, const FWorldContext& InWorldContext, EPlayNetMode InNetMode, UGameViewportClient* InViewportClient, FSlatePlayInEditorInfo& InSlateInfo)
{
FIntPoint WindowSize, WindowPosition;
GetWindowSizeAndPositionForInstanceIndex(*InSessionParams.EditorPlaySettings, InViewportIndex, InWorldContext, WindowSize, WindowPosition);
bool bCenterNewWindowOverride = false;
// VR Preview overrides window location.
const bool bVRPreview = InWorldContext.bIsPrimaryPIEInstance && InSessionParams.SessionPreviewTypeOverride.Get(EPlaySessionPreviewType::NoPreview) == EPlaySessionPreviewType::VRPreview;
// Because we could switch primary PIE on the fly, we should make all PIE windows with the same UI style
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:3285
Scope: file
Source code excerpt:
.Title(ViewportName)
.Tag("PIEWindow")
.ScreenPosition(FVector2D(WindowPosition.X, WindowPosition.Y))
.ClientSize(FVector2D(WindowSize.X, WindowSize.Y))
.AutoCenter(bCenterNewWindowOverride ? EAutoCenter::PreferredWorkArea : EAutoCenter::None)
.UseOSWindowBorder(bUseOSWndBorder)
.SaneWindowPlacement(!bCenterNewWindowOverride)
.SizingRule(ESizingRule::UserSized)
.AdjustInitialSizeAndPositionForDPIScale(false);
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PlayLevel.cpp:3386
Scope (from outer to inner):
file
function TSharedRef<SPIEViewport> UEditorEngine::GeneratePIEViewportWindow
function static void OnPIEWindowClosed
Source code excerpt:
FIntPoint WindowSize = FIntPoint(WindowBeingClosed->GetClientSizeInScreen().X, WindowBeingClosed->GetClientSizeInScreen().Y);
FIntPoint WindowPosition = FIntPoint(PIEWindowPos.X, PIEWindowPos.Y);
if (OwningEditorEngine.IsValid())
{
OwningEditorEngine->StoreWindowSizeAndPositionForInstanceIndex(ViewportIndex, WindowSize, WindowPosition);
if (PreviewFeatureLevelChangedHandle.IsValid())
{
OwningEditorEngine->OnPreviewFeatureLevelChanged().Remove(PreviewFeatureLevelChangedHandle);
}
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/PlayLevelNewProcess.cpp:268
Scope (from outer to inner):
file
function void UEditorEngine::LaunchNewProcess
Source code excerpt:
if (!InParams.EditorPlaySettings->CenterNewWindow && InParams.EditorPlaySettings->NewWindowPosition != FIntPoint::NoneValue)
{
FIntPoint WindowPosition = InParams.EditorPlaySettings->NewWindowPosition;
WindowPosition.X += FMath::Max(InInstanceNum - 1, 0) * WindowSize.X;
WindowPosition.Y += static_cast<int32>(SWindowDefs::DefaultTitleBarSize * FPlatformApplicationMisc::GetDPIScaleFactorAtPoint(0, 0));
// If they don't want to center the new window, we add a specific location. This will get saved to user settings
// via SAVEWINPOS and not end up reflected in our PlayInEditor settings.
CommandLine += FString::Printf(TEXT(" -WinX=%d -WinY=%d SAVEWINPOS=1"), WindowPosition.X, WindowPosition.Y);
}
// If the user didn't specify a resolution in the settings, default to full resolution.
if (WindowSize.X <= 0)
{
WindowSize.X = DisplayMetrics.PrimaryDisplayWidth;
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Toolkits/GlobalEditorCommonCommands.cpp:156
Scope (from outer to inner):
file
function TSharedPtr<IMenu> FGlobalEditorCommonCommands::OpenPopupMenu
Source code excerpt:
// Determine where the pop-up should open
TSharedPtr<SWindow> ParentWindow = FSlateApplication::Get().GetActiveTopLevelWindow();
FVector2D WindowPosition = FSlateApplication::Get().GetCursorPos();
if (!ParentWindow.IsValid())
{
TSharedPtr<SDockTab> LevelEditorTab = FModuleManager::Get().GetModuleChecked<FLevelEditorModule>("LevelEditor").GetLevelEditorTab();
ParentWindow = LevelEditorTab->GetParentWindow();
check(ParentWindow.IsValid());
}
#Loc: <Workspace>/Engine/Source/Editor/UnrealEd/Private/Toolkits/GlobalEditorCommonCommands.cpp:168
Scope (from outer to inner):
file
function TSharedPtr<IMenu> FGlobalEditorCommonCommands::OpenPopupMenu
Source code excerpt:
FSlateRect ParentMonitorRect = ParentWindow->GetFullScreenInfo();
const FVector2D MonitorCenter((ParentMonitorRect.Right + ParentMonitorRect.Left) * 0.5f, (ParentMonitorRect.Top + ParentMonitorRect.Bottom) * 0.5f);
WindowPosition = MonitorCenter - PopupDesiredSize * 0.5f;
// Open the pop-up
FPopupTransitionEffect TransitionEffect(FPopupTransitionEffect::None);
return FSlateApplication::Get().PushMenu(ParentWindow.ToSharedRef(), FWidgetPath(), WindowContents, WindowPosition, TransitionEffect, /*bFocusImmediately=*/ true);
}
return TSharedPtr<IMenu>();
}
static void CloseDebugConsole()
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateApplication.cpp:4166
Scope (from outer to inner):
file
function void TakeScreenshotCommon
Source code excerpt:
FVector2f Position = FVector2f(ArrangedWidget.Geometry.AbsolutePosition);
FVector2f Size = ArrangedWidget.Geometry.GetDrawSize();
FVector2f WindowPosition = WidgetWindow->GetPositionInScreen();
ScreenshotRect = InnerWidgetArea.IsEmpty() ? FIntRect(0, 0, (int32)Size.X, (int32)Size.Y) : InnerWidgetArea;
ScreenshotRect.Min.X += ( Position.X - WindowPosition.X );
ScreenshotRect.Min.Y += ( Position.Y - WindowPosition.Y );
ScreenshotRect.Max.X += ( Position.X - WindowPosition.X );
ScreenshotRect.Max.Y += ( Position.Y - WindowPosition.Y );
}
bool FSlateApplication::TakeScreenshot(const TSharedRef<SWidget>& Widget, const FIntRect& InnerWidgetArea, TArray<FColor>& OutColorData, FIntVector& OutSize)
{
// We can't screenshot the widget unless there's a valid window handle to draw it in.
TSharedPtr<SWindow> WidgetWindow = FSlateApplication::Get().FindWidgetWindow(Widget);
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Docking/TabManager.cpp:237
Scope (from outer to inner):
file
function TSharedRef<FTabManager::FLayoutNode> FTabManager::FLayout::NewFromString_Helper
Source code excerpt:
case FTabManager::FArea::Placement_Specified:
{
FVector2D WindowPosition = FVector2D::ZeroVector;
FVector2D WindowSize;
WindowPosition.X = (float)JsonObject->GetNumberField( TEXT("WindowPosition_X") );
WindowPosition.Y = (float)JsonObject->GetNumberField( TEXT("WindowPosition_Y") );
WindowSize.X = (float)JsonObject->GetNumberField( TEXT("WindowSize_X") );
WindowSize.Y = (float)JsonObject->GetNumberField( TEXT("WindowSize_Y") );
bool bIsMaximized = JsonObject->GetBoolField(TEXT("bIsMaximized"));
NewArea = FTabManager::NewArea( WindowSize );
NewArea->SetWindow( WindowPosition, bIsMaximized );
}
break;
}
NewArea->SetSizeCoefficient((float)JsonObject->GetNumberField( TEXT("SizeCoefficient") ) );
NewArea->SetOrientation( local::OrientationFromString( JsonObject->GetStringField(TEXT("Orientation")) ) );
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp:272
Scope (from outer to inner):
file
function void SWindow::Construct
Source code excerpt:
// calculate initial window position
FVector2f WindowPosition = InArgs._ScreenPosition;
const bool bAnchorWindowWindowPositionTopLeft = FPlatformApplicationMisc::AnchorWindowWindowPositionTopLeft();
if (bAnchorWindowWindowPositionTopLeft)
{
WindowPosition.X = WindowPosition.Y = 0;
}
else if (InArgs._AdjustInitialSizeAndPositionForDPIScale && !WindowPosition.IsZero())
{
// Will need to add additional logic to walk over multiple monitors at various DPIs to determine correct WindowPosition
const float InitialDPIScale = FPlatformApplicationMisc::GetDPIScaleFactorAtPoint(WindowPosition.X, WindowPosition.Y);
WindowPosition *= InitialDPIScale;
}
AutoCenterRule = InArgs._AutoCenter;
// Get desktop metrics
FDisplayMetrics DisplayMetrics;
FSlateApplicationBase::Get().GetCachedDisplayMetrics( DisplayMetrics );
const FPlatformRect& VirtualDisplayRect = DisplayMetrics.VirtualDisplayRect;
FPlatformRect PrimaryDisplayRect = AutoCenterRule == EAutoCenter::PrimaryWorkArea ? DisplayMetrics.PrimaryDisplayWorkAreaRect : DisplayMetrics.GetMonitorWorkAreaFromPoint(FVector2d(WindowPosition));
if (PrimaryDisplayRect == FPlatformRect(0, 0, 0, 0))
{
// If the primary display rect is empty we couldnt enumerate physical monitors (possibly remote desktop). So assume virtual display rect is primary rect
PrimaryDisplayRect = VirtualDisplayRect;
}
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp:320
Scope (from outer to inner):
file
function void SWindow::Construct
Source code excerpt:
// Check to see if the upper left corner of the window is outside the virtual
// bounds of the display, if so reset to preferred work area
if (WindowPosition.X < VirtualDisplayRect.Left ||
WindowPosition.X >= VirtualDisplayRect.Right ||
WindowPosition.Y < VirtualDisplayRect.Top ||
WindowPosition.Y >= VirtualDisplayRect.Bottom)
{
AutoCenterRule = EAutoCenter::PreferredWorkArea;
}
}
FSlateRect AutoCenterRect(0, 0, 0, 0);
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp:333
Scope (from outer to inner):
file
function void SWindow::Construct
Source code excerpt:
if (bAnchorWindowWindowPositionTopLeft)
{
WindowPosition.X = WindowPosition.Y = 0;
DPIScale = FPlatformApplicationMisc::GetDPIScaleFactorAtPoint(WindowPosition.X, WindowPosition.Y);
}
else if (AutoCenterRule != EAutoCenter::None)
{
switch( AutoCenterRule )
{
default:
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp:356
Scope (from outer to inner):
file
function void SWindow::Construct
Source code excerpt:
else
{
DPIScale = FPlatformApplicationMisc::GetDPIScaleFactorAtPoint(WindowPosition.X, WindowPosition.Y);
}
// If the window has no OS border, simulate it ourselves, enlarging window by the size that OS border would have.
const FVector2f DPIScaledClientSize = InArgs._AdjustInitialSizeAndPositionForDPIScale ? InArgs._ClientSize * DPIScale: FVector2f(InArgs._ClientSize);
FVector2f WindowSize = GetWindowSizeFromClientSize(DPIScaledClientSize, DPIScale);
#Loc: <Workspace>/Engine/Source/Runtime/SlateCore/Private/Widgets/SWindow.cpp:395
Scope (from outer to inner):
file
function void SWindow::Construct
Source code excerpt:
const FVector2f DisplaySize( AutoCenterRect.Right - AutoCenterRect.Left, AutoCenterRect.Bottom - AutoCenterRect.Top );
WindowPosition = DisplayTopLeft + (DisplaySize - WindowSize) * 0.5f;
// Don't allow the window to center to outside of the work area
WindowPosition.X = FMath::Max(WindowPosition.X, AutoCenterRect.Left);
WindowPosition.Y = FMath::Max(WindowPosition.Y, AutoCenterRect.Top);
}
this->InitialDesiredScreenPosition = WindowPosition;
this->InitialDesiredSize = WindowSize;
FSlateApplicationBase::Get().OnGlobalInvalidationToggled().AddSP(this, &SWindow::OnGlobalInvalidationToggled);
// Resize without adding extra borders / title because they are already included in WindowSize
ResizeWindowSize(WindowSize);