mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
code_style: move platform dependent code to initialize window to namespace SourceGit.Native
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
c62b4a031f
commit
ef4b639f8e
9 changed files with 41 additions and 68 deletions
|
@ -3,7 +3,6 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -11,7 +10,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
public bool UseSystemWindowFrame
|
||||
{
|
||||
get => OperatingSystem.IsLinux() && ViewModels.Preferences.Instance.UseSystemWindowFrame;
|
||||
get => Native.OS.UseSystemWindowFrame;
|
||||
}
|
||||
|
||||
protected override Type StyleKeyOverride => typeof(Window);
|
||||
|
@ -19,33 +18,6 @@ namespace SourceGit.Views
|
|||
public ChromelessWindow()
|
||||
{
|
||||
Focusable = true;
|
||||
|
||||
if (OperatingSystem.IsLinux())
|
||||
{
|
||||
if (UseSystemWindowFrame)
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.Default;
|
||||
ExtendClientAreaToDecorationsHint = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
Classes.Add("custom_window_frame");
|
||||
}
|
||||
}
|
||||
else if (OperatingSystem.IsWindows())
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
Classes.Add("fix_maximized_padding");
|
||||
}
|
||||
else
|
||||
{
|
||||
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome;
|
||||
ExtendClientAreaToDecorationsHint = true;
|
||||
}
|
||||
|
||||
Native.OS.SetupForWindow(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue