diff --git a/Source/Editor/Content/Proxy/ShaderProxy.cs b/Source/Editor/Content/Proxy/ShaderProxy.cs
index e6e288318..71350e277 100644
--- a/Source/Editor/Content/Proxy/ShaderProxy.cs
+++ b/Source/Editor/Content/Proxy/ShaderProxy.cs
@@ -29,7 +29,7 @@ namespace FlaxEditor.Content
if (asset)
{
var source = Editor.GetShaderSourceCode(asset);
- Utilities.Utils.ShowSourceCodeWindow(source, "Shader Source");
+ Utilities.Utils.ShowSourceCodeWindow(source, "Shader Source", item.RootWindow.Window);
}
return null;
}
diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs
index 18dff245f..f95b0896d 100644
--- a/Source/Editor/Utilities/Utils.cs
+++ b/Source/Editor/Utilities/Utils.cs
@@ -1643,7 +1643,8 @@ namespace FlaxEditor.Utilities
///
/// The source code.
/// The window title.
- public static void ShowSourceCodeWindow(string source, string title)
+ /// The optional parent window.
+ public static void ShowSourceCodeWindow(string source, string title, Window parentWindow = null)
{
if (string.IsNullOrEmpty(source))
{
@@ -1656,8 +1657,9 @@ namespace FlaxEditor.Utilities
settings.AllowMaximize = false;
settings.AllowMinimize = false;
settings.HasSizingFrame = false;
- settings.StartPosition = WindowStartPosition.CenterScreen;
- settings.Size = new Vector2(500, 600) * Platform.DpiScale; // TODO: Place the window on the correct screen (and use that screen's size)
+ settings.StartPosition = WindowStartPosition.CenterParent;
+ settings.Size = new Vector2(500, 600) * (parentWindow?.DpiScale ?? Platform.DpiScale);
+ settings.Parent = parentWindow;
settings.Title = title;
var dialog = Platform.CreateWindow(ref settings);
diff --git a/Source/Editor/Windows/Assets/MaterialWindow.cs b/Source/Editor/Windows/Assets/MaterialWindow.cs
index f49e6a79c..c96aaa2cb 100644
--- a/Source/Editor/Windows/Assets/MaterialWindow.cs
+++ b/Source/Editor/Windows/Assets/MaterialWindow.cs
@@ -241,10 +241,10 @@ namespace FlaxEditor.Windows.Assets
/// Shows the material source code window.
///
/// The material asset.
- public static void ShowSourceCode(Material material)
+ public void ShowSourceCode(Material material)
{
var source = Editor.GetShaderSourceCode(material);
- Utilities.Utils.ShowSourceCodeWindow(source, "Material Source");
+ Utilities.Utils.ShowSourceCodeWindow(source, "Material Source", RootWindow.Window);
}
///
diff --git a/Source/Editor/Windows/Assets/ParticleEmitterWindow.cs b/Source/Editor/Windows/Assets/ParticleEmitterWindow.cs
index 17b5a928d..21318ac49 100644
--- a/Source/Editor/Windows/Assets/ParticleEmitterWindow.cs
+++ b/Source/Editor/Windows/Assets/ParticleEmitterWindow.cs
@@ -147,10 +147,10 @@ namespace FlaxEditor.Windows.Assets
/// Shows the ParticleEmitter source code window.
///
/// The ParticleEmitter asset.
- public static void ShowSourceCode(ParticleEmitter particleEmitter)
+ public void ShowSourceCode(ParticleEmitter particleEmitter)
{
var source = Editor.GetShaderSourceCode(particleEmitter);
- Utilities.Utils.ShowSourceCodeWindow(source, "Particle Emitter GPU Simulation Source");
+ Utilities.Utils.ShowSourceCodeWindow(source, "Particle Emitter GPU Simulation Source", RootWindow.Window);
}
///
diff --git a/Source/Engine/Platform/Base/WindowBase.h b/Source/Engine/Platform/Base/WindowBase.h
index 6fab84504..6c45999af 100644
--- a/Source/Engine/Platform/Base/WindowBase.h
+++ b/Source/Engine/Platform/Base/WindowBase.h
@@ -551,7 +551,6 @@ public:
return _dpi;
}
- // TODO: This doesn't actually include the custom DPI scale
///
/// Gets the window DPI scale factor (1 is default). Includes custom DPI scale
///
diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.cpp b/Source/Engine/Platform/Windows/WindowsPlatform.cpp
index fae4add2d..be5df4d9c 100644
--- a/Source/Engine/Platform/Windows/WindowsPlatform.cpp
+++ b/Source/Engine/Platform/Windows/WindowsPlatform.cpp
@@ -58,7 +58,7 @@ int32 CalculateDpi(HMODULE shCoreDll)
if (getDPIForMonitor)
{
- HMONITOR monitor = GetPrimaryMonitorHandle(); // TODO: Use the game window monitor
+ HMONITOR monitor = GetPrimaryMonitorHandle();
UINT x = 0, y = 0;
HRESULT hr = getDPIForMonitor(monitor, 0, &x, &y);
diff --git a/Source/Engine/Platform/Windows/WindowsWindow.cpp b/Source/Engine/Platform/Windows/WindowsWindow.cpp
index 1b270d80b..74d56d4b9 100644
--- a/Source/Engine/Platform/Windows/WindowsWindow.cpp
+++ b/Source/Engine/Platform/Windows/WindowsWindow.cpp
@@ -99,7 +99,7 @@ WindowsWindow::WindowsWindow(const CreateWindowSettings& settings)
nullptr);
_dpi = DefaultDPI;
- // TODO: Is this the correct way of doing this?
+
const HMODULE user32Dll = LoadLibraryW(L"user32.dll");
if (user32Dll)
{