Improve tab-less dock window behavior in other platforms
Add checks for #3215 to hide the tab bar only if it doesn't prevent window dragging in Wayland sessions with native decorations.
This commit is contained in:
@@ -19,11 +19,7 @@ namespace FlaxEditor.GUI.Docking
|
||||
private float _tabHeight = Editor.Instance.Options.Options.Interface.TabHeight;
|
||||
private bool _useMinimumTabWidth = Editor.Instance.Options.Options.Interface.UseMinimumTabWidth;
|
||||
private float _minimumTabWidth = Editor.Instance.Options.Options.Interface.MinimumTabWidth;
|
||||
#if PLATFORM_WINDOWS
|
||||
private readonly bool _hideTabForSingleTab = Editor.Instance.Options.Options.Interface.HideSingleTabWindowTabBars;
|
||||
#else
|
||||
private readonly bool _hideTabForSingleTab = false;
|
||||
#endif
|
||||
private readonly bool _hideTabForSingleTab = Utilities.Utils.HideSingleTabWindowTabBars();
|
||||
|
||||
/// <summary>
|
||||
/// The is mouse down flag (left button).
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace FlaxEditor.Options
|
||||
public bool UseNativeWindowSystem { get; set; } = false;
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WINDOWS
|
||||
#if PLATFORM_SDL || PLATFORM_WINDOWS
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether a window containing a single tabs hides the tab bar. Editor restart recommended.
|
||||
/// </summary>
|
||||
|
||||
@@ -1571,5 +1571,19 @@ namespace FlaxEditor.Utilities
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
}
|
||||
|
||||
internal static bool HideSingleTabWindowTabBars()
|
||||
{
|
||||
#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;
|
||||
return draggableDecorations && Editor.Instance.Options.Options.Interface.HideSingleTabWindowTabBars;
|
||||
#elif PLATFORM_WINDOWS
|
||||
return Editor.Instance.Options.Options.Interface.HideSingleTabWindowTabBars;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,6 +274,15 @@ bool PlatformBase::SupportsNativeDecorations()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlatformBase::SupportsNativeDecorationDragging()
|
||||
{
|
||||
#if PLATFORM_LINUX
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool PlatformBase::Is64BitApp()
|
||||
|
||||
@@ -379,6 +379,11 @@ public:
|
||||
/// </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>
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace SDLImpl
|
||||
int32 SystemDpi = 96;
|
||||
String UserLocale("en");
|
||||
bool WindowDecorationsSupported = true;
|
||||
bool SupportsDecorationDragging = true;
|
||||
String WaylandDisplayEnv;
|
||||
String XDGCurrentDesktop;
|
||||
}
|
||||
@@ -63,6 +64,8 @@ bool SDLPlatform::Init()
|
||||
SDL_SetHint(SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR, "0");
|
||||
SDLImpl::WindowDecorationsSupported = false;
|
||||
}
|
||||
if (waylandSession)
|
||||
SupportsDecorationDragging = false;
|
||||
#endif
|
||||
|
||||
#if PLATFORM_LINUX
|
||||
@@ -204,6 +207,11 @@ bool SDLPlatform::SupportsNativeDecorations()
|
||||
return SDLImpl::WindowDecorationsSupported;
|
||||
}
|
||||
|
||||
bool SDLPlatform::SupportsNativeDecorationDragging()
|
||||
{
|
||||
return SDLImpl::SupportsDecorationDragging;
|
||||
}
|
||||
|
||||
BatteryInfo SDLPlatform::GetBatteryInfo()
|
||||
{
|
||||
BatteryInfo info;
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
static void Tick();
|
||||
static String GetDisplayServer();
|
||||
static bool SupportsNativeDecorations();
|
||||
static bool SupportsNativeDecorationDragging();
|
||||
static void SetHighDpiAwarenessEnabled(bool enable);
|
||||
static BatteryInfo GetBatteryInfo();
|
||||
static int32 GetDpi();
|
||||
|
||||
Reference in New Issue
Block a user