diff --git a/Source/Editor/Utilities/Utils.cs b/Source/Editor/Utilities/Utils.cs index 00853860c..d6d908f3f 100644 --- a/Source/Editor/Utilities/Utils.cs +++ b/Source/Editor/Utilities/Utils.cs @@ -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; diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index 19e7ae11a..29d13a2b0 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -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 diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h index 90bf8690e..535c825a1 100644 --- a/Source/Engine/Platform/Base/PlatformBase.h +++ b/Source/Engine/Platform/Base/PlatformBase.h @@ -369,16 +369,6 @@ public: /// API_PROPERTY() static PlatformType GetPlatformType(); - /// - /// Returns true if system provides decorations for windows. - /// - API_PROPERTY() static bool SupportsNativeDecorations(); - - /// - /// Returns true if system provides support for native window dragging events. - /// - API_PROPERTY() static bool SupportsNativeDecorationDragging(); - /// /// Returns true if is running 64 bit application (otherwise 32 bit). It's compile-time constant. /// diff --git a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp index d762c90d7..a9fabefba 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp @@ -1701,7 +1701,7 @@ String SDLPlatform::GetDisplayServer() void SDLPlatform::SetHighDpiAwarenessEnabled(bool enable) { - base::SetHighDpiAwarenessEnabled(enable); + SDLPlatformBase::SetHighDpiAwarenessEnabled(enable); } bool SDLPlatform::UsesWindows() diff --git a/Source/Engine/Platform/SDL/SDLPlatform.cpp b/Source/Engine/Platform/SDL/SDLPlatform.cpp index 9f8d46c2b..fd98e978b 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.cpp @@ -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() diff --git a/Source/Engine/Platform/SDL/SDLPlatform.h b/Source/Engine/Platform/SDL/SDLPlatform.h index d253ebb2e..bb8211485 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.h +++ b/Source/Engine/Platform/SDL/SDLPlatform.h @@ -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 + /// /// The SDL platform implementation and application management utilities. /// -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(); + /// + /// Returns true if system provides decorations for windows. + /// + API_PROPERTY() static bool SupportsNativeDecorations(); + + /// + /// Returns true if system provides support for native window dragging events. + /// + 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();