Fix client-side decorations in borderless editor game window on launch
This commit is contained in:
@@ -65,6 +65,31 @@ namespace FlaxEditor.GUI.Docking
|
||||
/// </summary>
|
||||
public bool IsDragging { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows client-side window decorations around this panel.
|
||||
/// </summary>
|
||||
public bool ShowDecorations
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (value == field)
|
||||
return;
|
||||
field = value;
|
||||
if (value)
|
||||
{
|
||||
var decorations = Parent.AddChild(new FloatWindowDecorations(this));
|
||||
decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
var decorations = Parent.GetChild<FloatWindowDecorations>();
|
||||
if (decorations != null)
|
||||
decorations.Dispose();
|
||||
}
|
||||
}
|
||||
} = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FloatWindowDockPanel"/> class.
|
||||
/// </summary>
|
||||
@@ -82,11 +107,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
_window.Window.Closing += OnClosing;
|
||||
_window.Window.LeftButtonHit += OnLeftButtonHit;
|
||||
|
||||
if (Utilities.Utils.UseCustomWindowDecorations())
|
||||
{
|
||||
var decorations = Parent.AddChild(new FloatWindowDecorations(this));
|
||||
decorations.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, false);
|
||||
}
|
||||
ShowDecorations = Utilities.Utils.UseCustomWindowDecorations();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -94,13 +115,10 @@ namespace FlaxEditor.GUI.Docking
|
||||
{
|
||||
base.PerformLayoutBeforeChildren();
|
||||
|
||||
var decorations = Parent.GetChild<FloatWindowDecorations>();
|
||||
if (decorations != null)
|
||||
{
|
||||
// Apply offset for the title bar
|
||||
foreach (var child in Children)
|
||||
child.Bounds = child.Bounds with { Y = decorations.Height, Height = Parent.Height - decorations.Height };
|
||||
}
|
||||
// Apply offset for the title bar
|
||||
var decorationsHeight = Parent.GetChild<FloatWindowDecorations>()?.Height ?? 0;
|
||||
foreach (var child in Children)
|
||||
child.Bounds = child.Bounds with { Y = decorationsHeight, Height = Parent.Height - decorationsHeight };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Xml;
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Docking;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Modules;
|
||||
using FlaxEditor.Options;
|
||||
@@ -331,6 +332,9 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
IsFloating = true;
|
||||
var rootWindow = RootWindow;
|
||||
var floatWin = rootWindow.GetChild<FloatWindowDockPanel>();
|
||||
if (floatWin != null && floatWin.ShowDecorations)
|
||||
floatWin.ShowDecorations = false;
|
||||
var monitorBounds = Platform.GetMonitorBounds(rootWindow.RootWindow.Window.ClientPosition);
|
||||
rootWindow.Window.Position = monitorBounds.Location;
|
||||
rootWindow.Window.SetBorderless(true);
|
||||
@@ -338,6 +342,9 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
var floatWin = RootWindow.GetChild<FloatWindowDockPanel>();
|
||||
if (floatWin != null && !floatWin.ShowDecorations && Utilities.Utils.UseCustomWindowDecorations())
|
||||
floatWin.ShowDecorations = true;
|
||||
IsFloating = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user