mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature: supports using native window frame on Linux (#390)
This commit is contained in:
parent
eaf5eba0e7
commit
d5e51d1f32
26 changed files with 218 additions and 39 deletions
|
@ -8,6 +8,25 @@ namespace SourceGit.Views
|
|||
{
|
||||
public partial class Launcher : ChromelessWindow
|
||||
{
|
||||
public static readonly StyledProperty<GridLength> CaptionHeightProperty =
|
||||
AvaloniaProperty.Register<Launcher, GridLength>(nameof(CaptionHeight));
|
||||
|
||||
public GridLength CaptionHeight
|
||||
{
|
||||
get => GetValue(CaptionHeightProperty);
|
||||
set => SetValue(CaptionHeightProperty, value);
|
||||
}
|
||||
|
||||
public bool IsRightCaptionButtonsVisible
|
||||
{
|
||||
get
|
||||
{
|
||||
if (OperatingSystem.IsLinux())
|
||||
return !ViewModels.Preference.Instance.UseSystemWindowFrame;
|
||||
return OperatingSystem.IsWindows();
|
||||
}
|
||||
}
|
||||
|
||||
public Launcher()
|
||||
{
|
||||
var layout = ViewModels.Preference.Instance.Layout;
|
||||
|
@ -17,6 +36,11 @@ namespace SourceGit.Views
|
|||
Height = layout.LauncherHeight;
|
||||
}
|
||||
|
||||
if (UseSystemWindowFrame)
|
||||
CaptionHeight = new GridLength(30);
|
||||
else
|
||||
CaptionHeight = new GridLength(38);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
@ -38,13 +62,15 @@ namespace SourceGit.Views
|
|||
{
|
||||
base.OnPropertyChanged(change);
|
||||
|
||||
if (change.Property == WindowStateProperty && MainLayout != null)
|
||||
if (change.Property == WindowStateProperty)
|
||||
{
|
||||
var state = (WindowState)change.NewValue!;
|
||||
if (state == WindowState.Maximized)
|
||||
MainLayout.RowDefinitions[0].Height = new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
|
||||
if (OperatingSystem.IsLinux() && UseSystemWindowFrame)
|
||||
CaptionHeight = new GridLength(30);
|
||||
else if (state == WindowState.Maximized)
|
||||
CaptionHeight = new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
|
||||
else
|
||||
MainLayout.RowDefinitions[0].Height = new GridLength(38);
|
||||
CaptionHeight = new GridLength(38);
|
||||
|
||||
ViewModels.Preference.Instance.Layout.LauncherWindowState = state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue