Move SupportsNativeDecorations/SupportsNativeDecorationDragging to SDLPlatform

#2800
This commit is contained in:
Wojtek Figat
2026-02-12 09:24:48 +01:00
parent c4d20f06ee
commit d68969dbe2
6 changed files with 27 additions and 51 deletions

View File

@@ -1589,8 +1589,8 @@ namespace FlaxEditor.Utilities
#if PLATFORM_SDL
return Editor.Instance.Options.Options.Interface.WindowDecorations switch
{
Options.InterfaceOptions.WindowDecorationsType.Auto => !Platform.SupportsNativeDecorations,
Options.InterfaceOptions.WindowDecorationsType.AutoChildOnly => !isMainWindow ? !Platform.SupportsNativeDecorations : true,
Options.InterfaceOptions.WindowDecorationsType.Auto => !SDLPlatform.SupportsNativeDecorations,
Options.InterfaceOptions.WindowDecorationsType.AutoChildOnly => !isMainWindow ? !SDLPlatform.SupportsNativeDecorations : true,
Options.InterfaceOptions.WindowDecorationsType.Native => false,
Options.InterfaceOptions.WindowDecorationsType.ClientSide => true,
_ => throw new ArgumentOutOfRangeException()
@@ -1607,7 +1607,7 @@ namespace FlaxEditor.Utilities
#if PLATFORM_SDL
// We should not hide the tab bars if tab handle is the only way to dock the window
bool clientSideDecorations = UseCustomWindowDecorations(false);
bool draggableDecorations = clientSideDecorations || Platform.SupportsNativeDecorationDragging;
bool draggableDecorations = clientSideDecorations || SDLPlatform.SupportsNativeDecorationDragging;
return draggableDecorations && Editor.Instance.Options.Options.Interface.HideSingleTabWindowTabBars;
#elif PLATFORM_WINDOWS
return Editor.Instance.Options.Options.Interface.HideSingleTabWindowTabBars;

View File

@@ -292,24 +292,6 @@ PlatformType PlatformBase::GetPlatformType()
return PLATFORM_TYPE;
}
#if !PLATFORM_SDL
bool PlatformBase::SupportsNativeDecorations()
{
return true;
}
bool PlatformBase::SupportsNativeDecorationDragging()
{
#if PLATFORM_LINUX
return false;
#else
return true;
#endif
}
#endif
bool PlatformBase::Is64BitApp()
{
#if PLATFORM_64BITS

View File

@@ -369,16 +369,6 @@ public:
/// </summary>
API_PROPERTY() static PlatformType GetPlatformType();
/// <summary>
/// Returns true if system provides decorations for windows.
/// </summary>
API_PROPERTY() static bool SupportsNativeDecorations();
/// <summary>
/// Returns true if system provides support for native window dragging events.
/// </summary>
API_PROPERTY() static bool SupportsNativeDecorationDragging();
/// <summary>
/// Returns true if is running 64 bit application (otherwise 32 bit). It's compile-time constant.
/// </summary>

View File

@@ -1701,7 +1701,7 @@ String SDLPlatform::GetDisplayServer()
void SDLPlatform::SetHighDpiAwarenessEnabled(bool enable)
{
base::SetHighDpiAwarenessEnabled(enable);
SDLPlatformBase::SetHighDpiAwarenessEnabled(enable);
}
bool SDLPlatform::UsesWindows()

View File

@@ -153,7 +153,7 @@ bool SDLPlatform::Init()
//SDL_StartTextInput(); // TODO: Call this only when text input is expected (shows virtual keyboard in some cases)
return base::Init();
return SDLPlatformBase::Init();
}
void SDLPlatform::LogInfo()

View File

@@ -20,26 +20,22 @@ static_assert(false, "Unsupported Platform");
class SDLWindow;
union SDL_Event;
#if PLATFORM_WINDOWS
typedef WindowsPlatform SDLPlatformBase;
#elif PLATFORM_LINUX
typedef LinuxPlatform SDLPlatformBase;
#elif PLATFORM_MAC
typedef MacPlatform SDLPlatformBase;
#else
static_assert(false, "Unsupported SDL platform.");
#endif
/// <summary>
/// The SDL platform implementation and application management utilities.
/// </summary>
class FLAXENGINE_API SDLPlatform
#if PLATFORM_WINDOWS
: public WindowsPlatform
API_CLASS(Static, Tag="NoTypeInitializer")
class FLAXENGINE_API SDLPlatform : public SDLPlatformBase
{
using base = WindowsPlatform;
#elif PLATFORM_LINUX
: public LinuxPlatform
{
using base = LinuxPlatform;
#elif PLATFORM_MAC
: public MacPlatform
{
using base = MacPlatform;
#else
{
static_assert(false, "Unsupported Platform");
#endif
friend SDLWindow;
private:
@@ -68,13 +64,21 @@ public:
static bool UsesWayland();
static bool UsesX11();
/// <summary>
/// Returns true if system provides decorations for windows.
/// </summary>
API_PROPERTY() static bool SupportsNativeDecorations();
/// <summary>
/// Returns true if system provides support for native window dragging events.
/// </summary>
API_PROPERTY() static bool SupportsNativeDecorationDragging();
public:
// [PlatformBase]
static bool Init();
static void LogInfo();
static void Tick();
static bool SupportsNativeDecorations();
static bool SupportsNativeDecorationDragging();
static void SetHighDpiAwarenessEnabled(bool enable);
#if !PLATFORM_WINDOWS
static BatteryInfo GetBatteryInfo();