refactor: window chrome style

This commit is contained in:
leo 2024-08-22 15:06:30 +08:00
parent 8b469e7778
commit 10e5c7aa6c
No known key found for this signature in database
2 changed files with 17 additions and 5 deletions

View file

@ -22,8 +22,6 @@
<Setter Property="Background" Value="{DynamicResource Brush.Window}"/> <Setter Property="Background" Value="{DynamicResource Brush.Window}"/>
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/> <Setter Property="BorderBrush" Value="{DynamicResource Brush.Border0}"/>
<Setter Property="ExtendClientAreaChromeHints" Value="NoChrome"/>
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True"/>
<Setter Property="SystemDecorations" Value="Full"/> <Setter Property="SystemDecorations" Value="Full"/>
<Setter Property="Padding" Value="0"/> <Setter Property="Padding" Value="0"/>

View file

@ -3,6 +3,7 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Input; using Avalonia.Input;
using Avalonia.Platform;
namespace SourceGit.Views namespace SourceGit.Views
{ {
@ -19,11 +20,24 @@ namespace SourceGit.Views
{ {
if (OperatingSystem.IsLinux()) if (OperatingSystem.IsLinux())
{ {
if (!UseSystemWindowFrame) if (UseSystemWindowFrame)
{
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default;
ExtendClientAreaToDecorationsHint = false;
}
else
{
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
ExtendClientAreaToDecorationsHint = true;
Classes.Add("custom_window_frame"); Classes.Add("custom_window_frame");
} }
else if (OperatingSystem.IsWindows()) }
else
{ {
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
ExtendClientAreaToDecorationsHint = true;
if (OperatingSystem.IsWindows())
Classes.Add("fix_maximized_padding"); Classes.Add("fix_maximized_padding");
} }
} }