From a56903d3ade19924d5ff407a1883213f88dfd321 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Tue, 25 Aug 2026 22:33:39 +0300 Subject: [PATCH] Fix client-side decorations in borderless editor game window on launch --- .../GUI/Docking/FloatWindowDockPanel.cs | 42 +++++++++++++------ Source/Editor/Windows/GameWindow.cs | 7 ++++ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs b/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs index b47d76bdd..788631daa 100644 --- a/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs +++ b/Source/Editor/GUI/Docking/FloatWindowDockPanel.cs @@ -65,6 +65,31 @@ namespace FlaxEditor.GUI.Docking /// public bool IsDragging { get; internal set; } + /// + /// Shows client-side window decorations around this panel. + /// + 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(); + if (decorations != null) + decorations.Dispose(); + } + } + } = false; + /// /// Initializes a new instance of the class. /// @@ -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(); } /// @@ -94,13 +115,10 @@ namespace FlaxEditor.GUI.Docking { base.PerformLayoutBeforeChildren(); - var decorations = Parent.GetChild(); - 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()?.Height ?? 0; + foreach (var child in Children) + child.Bounds = child.Bounds with { Y = decorationsHeight, Height = Parent.Height - decorationsHeight }; } /// diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index 8c3793627..9419fbb51 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -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(); + 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(); + if (floatWin != null && !floatWin.ShowDecorations && Utilities.Utils.UseCustomWindowDecorations()) + floatWin.ShowDecorations = true; IsFloating = false; } }