fix: wrong window margin and border if window is started as maximized

This commit is contained in:
leo 2024-07-26 12:01:09 +08:00
parent 17b0d7ddcb
commit d3be3e938f
No known key found for this signature in database
3 changed files with 17 additions and 10 deletions

View file

@ -66,7 +66,7 @@ namespace SourceGit.ViewModels
{ {
Dispatcher.UIThread.Invoke(() => Remote = text); Dispatcher.UIThread.Invoke(() => Remote = text);
} }
} }
catch catch
{ {
// ignore // ignore

View file

@ -83,14 +83,14 @@ namespace SourceGit.Views
static CommitRefsPresenter() static CommitRefsPresenter()
{ {
AffectsMeasure<CommitRefsPresenter>( AffectsMeasure<CommitRefsPresenter>(
FontFamilyProperty, FontFamilyProperty,
FontSizeProperty, FontSizeProperty,
LabelForegroundProperty); LabelForegroundProperty);
AffectsRender<CommitRefsPresenter>( AffectsRender<CommitRefsPresenter>(
IconBackgroundProperty, IconBackgroundProperty,
IconForegroundProperty, IconForegroundProperty,
BranchNameBackgroundProperty, BranchNameBackgroundProperty,
TagNameBackgroundProperty); TagNameBackgroundProperty);
} }
@ -102,7 +102,7 @@ namespace SourceGit.Views
var iconFG = IconForeground; var iconFG = IconForeground;
var iconBG = IconBackground; var iconBG = IconBackground;
var branchBG = BranchNameBackground; var branchBG = BranchNameBackground;
var tagBG = TagNameBackground; var tagBG = TagNameBackground;
var x = 0.0; var x = 0.0;
foreach (var item in _items) foreach (var item in _items)
@ -141,7 +141,7 @@ namespace SourceGit.Views
foreach (var decorator in commit.Decorators) foreach (var decorator in commit.Decorators)
{ {
var isHead = decorator.Type == Models.DecoratorType.CurrentBranchHead || var isHead = decorator.Type == Models.DecoratorType.CurrentBranchHead ||
decorator.Type == Models.DecoratorType.CurrentCommitHead; decorator.Type == Models.DecoratorType.CurrentCommitHead;
var label = new FormattedText( var label = new FormattedText(

View file

@ -11,9 +11,7 @@ namespace SourceGit.Views
public Launcher() public Launcher()
{ {
var layout = ViewModels.Preference.Instance.Layout; var layout = ViewModels.Preference.Instance.Layout;
WindowState = layout.LauncherWindowState; if (layout.LauncherWindowState != WindowState.Maximized)
if (WindowState != WindowState.Maximized)
{ {
Width = layout.LauncherWidth; Width = layout.LauncherWidth;
Height = layout.LauncherHeight; Height = layout.LauncherHeight;
@ -22,6 +20,15 @@ namespace SourceGit.Views
InitializeComponent(); InitializeComponent();
} }
protected override void OnOpened(EventArgs e)
{
base.OnOpened(e);
var layout = ViewModels.Preference.Instance.Layout;
if (layout.LauncherWindowState == WindowState.Maximized)
WindowState = WindowState.Maximized;
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{ {
base.OnPropertyChanged(change); base.OnPropertyChanged(change);