mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
fix: window border artifacts when drag maximized window to another monitor
This commit is contained in:
parent
f8c4137c78
commit
ac00d1a221
2 changed files with 16 additions and 4 deletions
|
@ -13,9 +13,6 @@
|
||||||
Icon="/App.ico"
|
Icon="/App.ico"
|
||||||
Title="SourceGit"
|
Title="SourceGit"
|
||||||
MinWidth="1280" MinHeight="720"
|
MinWidth="1280" MinHeight="720"
|
||||||
Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWidth, Mode=TwoWay}"
|
|
||||||
Height="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherHeight, Mode=TwoWay}"
|
|
||||||
WindowState="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWindowState, Mode=TwoWay}"
|
|
||||||
WindowStartupLocation="CenterScreen">
|
WindowStartupLocation="CenterScreen">
|
||||||
<Grid x:Name="MainLayout">
|
<Grid x:Name="MainLayout">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
|
|
@ -12,19 +12,30 @@ namespace SourceGit.Views
|
||||||
public Launcher()
|
public Launcher()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
var layout = ViewModels.Preference.Instance.Layout;
|
||||||
|
WindowState = layout.LauncherWindowState;
|
||||||
|
|
||||||
|
if (WindowState != WindowState.Maximized)
|
||||||
|
{
|
||||||
|
Width = layout.LauncherWidth;
|
||||||
|
Height = layout.LauncherHeight;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
|
||||||
{
|
{
|
||||||
base.OnPropertyChanged(change);
|
base.OnPropertyChanged(change);
|
||||||
|
|
||||||
if (change.Property == WindowStateProperty)
|
if (change.Property == WindowStateProperty && MainLayout != null)
|
||||||
{
|
{
|
||||||
var state = (WindowState)change.NewValue;
|
var state = (WindowState)change.NewValue;
|
||||||
if (state == WindowState.Maximized)
|
if (state == WindowState.Maximized)
|
||||||
MainLayout.RowDefinitions[0].Height = new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
|
MainLayout.RowDefinitions[0].Height = new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
|
||||||
else
|
else
|
||||||
MainLayout.RowDefinitions[0].Height = new GridLength(38);
|
MainLayout.RowDefinitions[0].Height = new GridLength(38);
|
||||||
|
|
||||||
|
ViewModels.Preference.Instance.Layout.LauncherWindowState = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,6 +135,10 @@ namespace SourceGit.Views
|
||||||
|
|
||||||
protected override void OnClosing(WindowClosingEventArgs e)
|
protected override void OnClosing(WindowClosingEventArgs e)
|
||||||
{
|
{
|
||||||
|
var pref = ViewModels.Preference.Instance;
|
||||||
|
pref.Layout.LauncherWidth = Width;
|
||||||
|
pref.Layout.LauncherHeight = Height;
|
||||||
|
|
||||||
var vm = DataContext as ViewModels.Launcher;
|
var vm = DataContext as ViewModels.Launcher;
|
||||||
vm.Quit();
|
vm.Quit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue