Enable native windowing system settings with SDL platform

This commit is contained in:
2024-07-25 21:30:58 +03:00
committed by Ari Vuollet
parent 8f2550ef61
commit 94d6f213a0
5 changed files with 12 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ namespace FlaxEditor.GUI
/// <seealso cref="FlaxEngine.GUI.ContainerControl" /> /// <seealso cref="FlaxEngine.GUI.ContainerControl" />
public sealed class MainMenu : ContainerControl public sealed class MainMenu : ContainerControl
{ {
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
private bool _useCustomWindowSystem; private bool _useCustomWindowSystem;
private Image _icon; private Image _icon;
private Label _title; private Label _title;
@@ -67,7 +67,7 @@ namespace FlaxEditor.GUI
AutoFocus = false; AutoFocus = false;
AnchorPreset = AnchorPresets.HorizontalStretchTop; AnchorPreset = AnchorPresets.HorizontalStretchTop;
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
_useCustomWindowSystem = !Editor.Instance.Options.Options.Interface.UseNativeWindowSystem; _useCustomWindowSystem = !Editor.Instance.Options.Options.Interface.UseNativeWindowSystem;
if (_useCustomWindowSystem) if (_useCustomWindowSystem)
{ {
@@ -166,7 +166,7 @@ namespace FlaxEditor.GUI
} }
} }
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
/// <inheritdoc /> /// <inheritdoc />
public override void Update(float deltaTime) public override void Update(float deltaTime)
{ {
@@ -291,7 +291,7 @@ namespace FlaxEditor.GUI
if (base.OnMouseDoubleClick(location, button)) if (base.OnMouseDoubleClick(location, button))
return true; return true;
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
var child = GetChildAtRecursive(location); var child = GetChildAtRecursive(location);
if (_useCustomWindowSystem && child is not Button && child is not MainMenuButton) if (_useCustomWindowSystem && child is not Button && child is not MainMenuButton)
{ {
@@ -321,7 +321,7 @@ namespace FlaxEditor.GUI
{ {
float x = 0; float x = 0;
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
if (_useCustomWindowSystem) if (_useCustomWindowSystem)
{ {
// Icon // Icon
@@ -349,7 +349,7 @@ namespace FlaxEditor.GUI
} }
} }
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
if (_useCustomWindowSystem) if (_useCustomWindowSystem)
{ {
// Buttons // Buttons
@@ -367,7 +367,7 @@ namespace FlaxEditor.GUI
#endif #endif
} }
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
/// <inheritdoc /> /// <inheritdoc />
public override void OnDestroy() public override void OnDestroy()
{ {

View File

@@ -42,7 +42,7 @@ namespace FlaxEditor.GUI
Text = text; Text = text;
var style = Style.Current; var style = Style.Current;
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
if (Editor.Instance.Options.Options.Interface.UseNativeWindowSystem) if (Editor.Instance.Options.Options.Interface.UseNativeWindowSystem)
{ {
BackgroundColorMouseOver = style.BackgroundHighlighted; BackgroundColorMouseOver = style.BackgroundHighlighted;

View File

@@ -381,7 +381,7 @@ namespace FlaxEditor.Modules
Editor.Options.OptionsChanged += OnOptionsChanged; Editor.Options.OptionsChanged += OnOptionsChanged;
// Add dummy control for drawing the main window borders if using a custom style // 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) if (!Editor.Options.Options.Interface.UseNativeWindowSystem)
#endif #endif
{ {

View File

@@ -765,8 +765,10 @@ namespace FlaxEditor.Modules
{ {
settings.HasBorder = false; settings.HasBorder = false;
#if !PLATFORM_SDL
// Skip OS sizing frame and implement it using LeftButtonHit // Skip OS sizing frame and implement it using LeftButtonHit
settings.HasSizingFrame = false; settings.HasSizingFrame = false;
#endif
} }
#elif PLATFORM_LINUX #elif PLATFORM_LINUX
settings.HasBorder = false; settings.HasBorder = false;

View File

@@ -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.")] [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; public float InterfaceScale { get; set; } = 1.0f;
#if PLATFORM_WINDOWS #if PLATFORM_WINDOWS || PLATFORM_SDL
/// <summary> /// <summary>
/// Gets or sets a value indicating whether use native window title bar. Editor restart required. /// Gets or sets a value indicating whether use native window title bar. Editor restart required.
/// </summary> /// </summary>