From e58784a028ea763f42056153385805fe10c79222 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Fri, 28 Jun 2024 12:37:03 +0000 Subject: [PATCH 1/2] move platformbinding for theme variant from WindowBase up to TopLevel. --- src/Avalonia.Controls/TopLevel.cs | 5 +++++ src/Avalonia.Controls/WindowBase.cs | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs index b9b0c29523b..e6957ddda46 100644 --- a/src/Avalonia.Controls/TopLevel.cs +++ b/src/Avalonia.Controls/TopLevel.cs @@ -232,6 +232,11 @@ public TopLevel(ITopLevelImpl impl, IAvaloniaDependencyResolver? dependencyResol impl.TransparencyLevelChanged = HandleTransparencyLevelChanged; CreatePlatformImplBinding(TransparencyLevelHintProperty, hint => PlatformImpl.SetTransparencyLevelHint(hint ?? Array.Empty())); + CreatePlatformImplBinding(ActualThemeVariantProperty, variant => + { + variant ??= ThemeVariant.Default; + PlatformImpl?.SetFrameThemeVariant((PlatformThemeVariant?)variant ?? PlatformThemeVariant.Light); + }); _keyboardNavigationHandler?.SetOwner(this); _accessKeyHandler?.SetOwner(this); diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs index 6715c8e4bc3..fa4db1b6b9e 100644 --- a/src/Avalonia.Controls/WindowBase.cs +++ b/src/Avalonia.Controls/WindowBase.cs @@ -48,11 +48,6 @@ static WindowBase() public WindowBase(IWindowBaseImpl impl) : this(impl, AvaloniaLocator.Current) { CreatePlatformImplBinding(TopmostProperty, topmost => PlatformImpl!.SetTopmost(topmost)); - CreatePlatformImplBinding(ActualThemeVariantProperty, variant => - { - variant ??= ThemeVariant.Default; - PlatformImpl?.SetFrameThemeVariant((PlatformThemeVariant?)variant ?? PlatformThemeVariant.Light); - }); FrameSize = impl.FrameSize; } From b98aefb0e9ae6346a1d0825fd2a9bbf79ed9ae97 Mon Sep 17 00:00:00 2001 From: Emmanuel Hansen Date: Fri, 28 Jun 2024 12:37:25 +0000 Subject: [PATCH 2/2] remvoe visibility check in android insets manager for system theme --- .../Avalonia.Android/Platform/AndroidInsetsManager.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs b/src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs index 18cad0aebfc..c78945d4a0a 100644 --- a/src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs +++ b/src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs @@ -191,11 +191,6 @@ public SystemBarTheme? SystemBarTheme { _statusBarTheme = value; - if (!_topLevel.View.IsShown) - { - return; - } - var compat = new WindowInsetsControllerCompat(Window, _topLevel.View); if (_isDefaultSystemBarLightTheme == null) @@ -229,11 +224,6 @@ public bool? IsSystemBarVisible { _systemUiVisibility = value; - if (!_topLevel.View.IsShown) - { - return; - } - var compat = WindowCompat.GetInsetsController(Window, _topLevel.View); if (value == null || value.Value)