refactor: rewrite chromeless window (#634)

* use system chrome instead of custom caption button on macOS
* move `BeginMoveWindow` and `MaximizeOrRestoreWindow` to `ChromelessWindow`
* better supports for fullscreen mode on macOS
* redesign the layout of title bar for all windows

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2024-10-31 21:36:51 +08:00
parent 1999e4bf47
commit e3c0f7d496
No known key found for this signature in database
44 changed files with 222 additions and 664 deletions

View file

@ -32,14 +32,35 @@ namespace SourceGit.Views
Classes.Add("custom_window_frame");
}
}
else
else if (OperatingSystem.IsWindows())
{
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
ExtendClientAreaToDecorationsHint = true;
if (OperatingSystem.IsWindows())
Classes.Add("fix_maximized_padding");
Classes.Add("fix_maximized_padding");
}
else
{
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.SystemChrome;
ExtendClientAreaToDecorationsHint = true;
}
}
public void BeginMoveWindow(object _, PointerPressedEventArgs e)
{
if (e.ClickCount == 1)
BeginMoveDrag(e);
e.Handled = true;
}
public void MaximizeOrRestoreWindow(object _, TappedEventArgs e)
{
if (WindowState == WindowState.Maximized)
WindowState = WindowState.Normal;
else
WindowState = WindowState.Maximized;
e.Handled = true;
}
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)