Skip to content

Commit ac00d1a

Browse files
committed
fix: window border artifacts when drag maximized window to another monitor
1 parent f8c4137 commit ac00d1a

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/Views/Launcher.axaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
Icon="/App.ico"
1414
Title="SourceGit"
1515
MinWidth="1280" MinHeight="720"
16-
Width="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWidth, Mode=TwoWay}"
17-
Height="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherHeight, Mode=TwoWay}"
18-
WindowState="{Binding Source={x:Static vm:Preference.Instance}, Path=Layout.LauncherWindowState, Mode=TwoWay}"
1916
WindowStartupLocation="CenterScreen">
2017
<Grid x:Name="MainLayout">
2118
<Grid.RowDefinitions>

src/Views/Launcher.axaml.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,30 @@ public partial class Launcher : ChromelessWindow
1212
public Launcher()
1313
{
1414
InitializeComponent();
15+
16+
var layout = ViewModels.Preference.Instance.Layout;
17+
WindowState = layout.LauncherWindowState;
18+
19+
if (WindowState != WindowState.Maximized)
20+
{
21+
Width = layout.LauncherWidth;
22+
Height = layout.LauncherHeight;
23+
}
1524
}
1625

1726
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
1827
{
1928
base.OnPropertyChanged(change);
2029

21-
if (change.Property == WindowStateProperty)
30+
if (change.Property == WindowStateProperty && MainLayout != null)
2231
{
2332
var state = (WindowState)change.NewValue;
2433
if (state == WindowState.Maximized)
2534
MainLayout.RowDefinitions[0].Height = new GridLength(OperatingSystem.IsMacOS() ? 34 : 30);
2635
else
2736
MainLayout.RowDefinitions[0].Height = new GridLength(38);
37+
38+
ViewModels.Preference.Instance.Layout.LauncherWindowState = state;
2839
}
2940
}
3041

@@ -124,6 +135,10 @@ protected override void OnKeyDown(KeyEventArgs e)
124135

125136
protected override void OnClosing(WindowClosingEventArgs e)
126137
{
138+
var pref = ViewModels.Preference.Instance;
139+
pref.Layout.LauncherWidth = Width;
140+
pref.Layout.LauncherHeight = Height;
141+
127142
var vm = DataContext as ViewModels.Launcher;
128143
vm.Quit();
129144

0 commit comments

Comments
 (0)