From 10e5c7aa6c3af2690ff39ebc0572c47fce982af9 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 22 Aug 2024 15:06:30 +0800 Subject: [PATCH] refactor: window chrome style --- src/Resources/Styles.axaml | 2 -- src/Views/ChromelessWindow.cs | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index 7e3b65e3..65a3b493 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -22,8 +22,6 @@ - - diff --git a/src/Views/ChromelessWindow.cs b/src/Views/ChromelessWindow.cs index 9f637a15..a9b9f259 100644 --- a/src/Views/ChromelessWindow.cs +++ b/src/Views/ChromelessWindow.cs @@ -3,6 +3,7 @@ using Avalonia.Controls; using Avalonia.Controls.Primitives; using Avalonia.Input; +using Avalonia.Platform; namespace SourceGit.Views { @@ -19,12 +20,25 @@ namespace SourceGit.Views { if (OperatingSystem.IsLinux()) { - if (!UseSystemWindowFrame) + if (UseSystemWindowFrame) + { + ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default; + ExtendClientAreaToDecorationsHint = false; + } + else + { + ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome; + ExtendClientAreaToDecorationsHint = true; Classes.Add("custom_window_frame"); + } } - else if (OperatingSystem.IsWindows()) + else { - Classes.Add("fix_maximized_padding"); + ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome; + ExtendClientAreaToDecorationsHint = true; + + if (OperatingSystem.IsWindows()) + Classes.Add("fix_maximized_padding"); } }