From dddd978b376d7976886012b95f0b8c7992cd3bbf Mon Sep 17 00:00:00 2001 From: chinboy Date: Sun, 10 Aug 2025 22:55:46 +0800 Subject: [PATCH] Fix window maximize bug for macOS --- .../TokenResourceConst.g.cs | 1 + .../Themes/SearchEditDecoratedBoxTheme.axaml | 1 + .../ListBox/Themes/ListBoxItemTheme.axaml | 10 ++--- src/AtomUI.Controls/Popup/PopupBuddyLayer.cs | 6 ++- src/AtomUI.Controls/Switch/SwitchKnob.cs | 45 +++++++++---------- .../Switch/Themes/ToggleSwitchTheme.axaml | 2 +- .../Switch/ToggleSwitchToken.cs | 31 +++++++++++-- .../TabControl/BaseTabControl.cs | 1 + .../TabControl/TabStrip/BaseTabStrip.cs | 2 +- .../Window/Themes/WindowTheme.axaml | 11 ++++- src/AtomUI.Controls/Window/Window.cs | 2 +- 11 files changed, 76 insertions(+), 36 deletions(-) diff --git a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs index 848b1cf9d..b15e8430c 100644 --- a/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs +++ b/src/AtomUI.Controls/GeneratedFiles/AtomUI.Generator/AtomUI.Generator.TokenResourceKeyGenerator/TokenResourceConst.g.cs @@ -703,6 +703,7 @@ namespace AtomUI.Theme.Styling public static readonly TokenResourceKey InnerMinMargin = new TokenResourceKey("ToggleSwitch.InnerMinMargin"); public static readonly TokenResourceKey InnerMinMarginSM = new TokenResourceKey("ToggleSwitch.InnerMinMarginSM"); public static readonly TokenResourceKey LoadingAnimationDuration = new TokenResourceKey("ToggleSwitch.LoadingAnimationDuration"); + public static readonly TokenResourceKey OffStateLoadIndicatorColor = new TokenResourceKey("ToggleSwitch.OffStateLoadIndicatorColor"); public static readonly TokenResourceKey SwitchColor = new TokenResourceKey("ToggleSwitch.SwitchColor"); public static readonly TokenResourceKey SwitchDisabledOpacity = new TokenResourceKey("ToggleSwitch.SwitchDisabledOpacity"); public static readonly TokenResourceKey TrackHeight = new TokenResourceKey("ToggleSwitch.TrackHeight"); diff --git a/src/AtomUI.Controls/Input/Themes/SearchEditDecoratedBoxTheme.axaml b/src/AtomUI.Controls/Input/Themes/SearchEditDecoratedBoxTheme.axaml index d66605e1e..c05ff96d7 100644 --- a/src/AtomUI.Controls/Input/Themes/SearchEditDecoratedBoxTheme.axaml +++ b/src/AtomUI.Controls/Input/Themes/SearchEditDecoratedBoxTheme.axaml @@ -37,6 +37,7 @@ Name="{x:Static atom:AddOnDecoratedBoxThemeConstants.RightAddOnPart}" Grid.Column="2" Focusable="True" + IsEnabled="{TemplateBinding IsEnabled}" Icon="{atom:IconProvider SearchOutlined}" BackgroundSizing="OuterBorderEdge" Content="{TemplateBinding SearchButtonText}" diff --git a/src/AtomUI.Controls/ListBox/Themes/ListBoxItemTheme.axaml b/src/AtomUI.Controls/ListBox/Themes/ListBoxItemTheme.axaml index 30fb99622..7c543cf90 100644 --- a/src/AtomUI.Controls/ListBox/Themes/ListBoxItemTheme.axaml +++ b/src/AtomUI.Controls/ListBox/Themes/ListBoxItemTheme.axaml @@ -24,16 +24,16 @@ - - + + + + + + \ No newline at end of file diff --git a/src/AtomUI.Controls/Window/Window.cs b/src/AtomUI.Controls/Window/Window.cs index 1e373bbdb..c0c81519b 100644 --- a/src/AtomUI.Controls/Window/Window.cs +++ b/src/AtomUI.Controls/Window/Window.cs @@ -311,7 +311,7 @@ public class Window : AvaloniaWindow, IOperationSystemAware, IDisposable return; } - if (windowState == WindowState.Normal && IsMaximizeCaptionButtonEnabled) + if (windowState == WindowState.Normal && (OperationSystemType == OperationSystemType.macOS || IsMaximizeCaptionButtonEnabled)) { WindowState = WindowState.Maximized; }