From 8a0ce55fecfe6af0a221e73e382f22e489e593ed Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Thu, 25 Jul 2024 21:30:58 +0300 Subject: [PATCH] Enable native windowing system settings with SDL platform --- Source/Editor/GUI/MainMenu.cs | 14 +++++++------- Source/Editor/GUI/MainMenuButton.cs | 2 +- Source/Editor/Modules/UIModule.cs | 2 +- Source/Editor/Modules/WindowsModule.cs | 2 ++ Source/Editor/Options/InterfaceOptions.cs | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/Editor/GUI/MainMenu.cs b/Source/Editor/GUI/MainMenu.cs index a0a120518..1869d01ee 100644 --- a/Source/Editor/GUI/MainMenu.cs +++ b/Source/Editor/GUI/MainMenu.cs @@ -12,7 +12,7 @@ namespace FlaxEditor.GUI /// public sealed class MainMenu : ContainerControl { -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL private bool _useCustomWindowSystem; private Image _icon; private Label _title; @@ -67,7 +67,7 @@ namespace FlaxEditor.GUI AutoFocus = false; AnchorPreset = AnchorPresets.HorizontalStretchTop; -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL _useCustomWindowSystem = !Editor.Instance.Options.Options.Interface.UseNativeWindowSystem; if (_useCustomWindowSystem) { @@ -166,7 +166,7 @@ namespace FlaxEditor.GUI } } -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL /// public override void Update(float deltaTime) { @@ -291,7 +291,7 @@ namespace FlaxEditor.GUI if (base.OnMouseDoubleClick(location, button)) return true; -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL var child = GetChildAtRecursive(location); if (_useCustomWindowSystem && child is not Button && child is not MainMenuButton) { @@ -321,7 +321,7 @@ namespace FlaxEditor.GUI { float x = 0; -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL if (_useCustomWindowSystem) { // Icon @@ -349,7 +349,7 @@ namespace FlaxEditor.GUI } } -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL if (_useCustomWindowSystem) { // Buttons @@ -367,7 +367,7 @@ namespace FlaxEditor.GUI #endif } -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL /// public override void OnDestroy() { diff --git a/Source/Editor/GUI/MainMenuButton.cs b/Source/Editor/GUI/MainMenuButton.cs index 50be81b9f..89d1713f7 100644 --- a/Source/Editor/GUI/MainMenuButton.cs +++ b/Source/Editor/GUI/MainMenuButton.cs @@ -42,7 +42,7 @@ namespace FlaxEditor.GUI Text = text; var style = Style.Current; -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL if (Editor.Instance.Options.Options.Interface.UseNativeWindowSystem) { BackgroundColorMouseOver = style.BackgroundHighlighted; diff --git a/Source/Editor/Modules/UIModule.cs b/Source/Editor/Modules/UIModule.cs index cbd94ef41..6d4ed276c 100644 --- a/Source/Editor/Modules/UIModule.cs +++ b/Source/Editor/Modules/UIModule.cs @@ -381,7 +381,7 @@ namespace FlaxEditor.Modules Editor.Options.OptionsChanged += OnOptionsChanged; // Add dummy control for drawing the main window borders if using a custom style -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL if (!Editor.Options.Options.Interface.UseNativeWindowSystem) #endif { diff --git a/Source/Editor/Modules/WindowsModule.cs b/Source/Editor/Modules/WindowsModule.cs index fa7a04d9b..d95ddcabe 100644 --- a/Source/Editor/Modules/WindowsModule.cs +++ b/Source/Editor/Modules/WindowsModule.cs @@ -760,8 +760,10 @@ namespace FlaxEditor.Modules { settings.HasBorder = false; +#if !PLATFORM_SDL // Skip OS sizing frame and implement it using LeftButtonHit settings.HasSizingFrame = false; +#endif } #elif PLATFORM_LINUX settings.HasBorder = false; diff --git a/Source/Editor/Options/InterfaceOptions.cs b/Source/Editor/Options/InterfaceOptions.cs index 3b80cd63c..12cab705f 100644 --- a/Source/Editor/Options/InterfaceOptions.cs +++ b/Source/Editor/Options/InterfaceOptions.cs @@ -167,7 +167,7 @@ namespace FlaxEditor.Options [EditorDisplay("Interface"), EditorOrder(10), Tooltip("Editor User Interface scale. Applied to all UI elements, windows and text. Can be used to scale the interface up on a bigger display. Editor restart required.")] public float InterfaceScale { get; set; } = 1.0f; -#if PLATFORM_WINDOWS +#if PLATFORM_WINDOWS || PLATFORM_SDL /// /// Gets or sets a value indicating whether use native window title bar. Editor restart required. ///