Skip to content

Commit bd742ce

Browse files
committed
ui: use custom window chrome on Windows
1 parent fd66094 commit bd742ce

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/shared/Core/UI/Controls/DialogWindow.axaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
ShowInTaskbar="True" ShowActivated="True"
1616
PointerPressed="Window_PointerPressed"
1717
KeyUp="Window_KeyUp">
18-
<!--
19-
BUG: We cannot use the ExtendClientArea* properties on Windows because the platform implementation
20-
incorrectly sets the size of the window and we end up with a very wide window:
21-
https://github.com/AvaloniaUI/Avalonia/issues/5632
22-
23-
This is less of an issue because we're still using the WPF-based UI on Windows.
24-
-->
2518
<Design.DataContext>
2619
<vm:WindowViewModel/>
2720
</Design.DataContext>
@@ -66,8 +59,8 @@
6659
<TextBlock Text="DEBUG:" Margin="5,0" Foreground="#888888" VerticalAlignment="Center"/>
6760
<CheckBox IsChecked="{Binding ExtendClientArea}"
6861
Content="Extend Client Area" Margin="5,0"/>
69-
<CheckBox IsChecked="{Binding ShowClientChromeOverride}"
70-
Content="Show Client Chrome" Margin="5,0"/>
62+
<CheckBox IsChecked="{Binding ShowCustomChromeOverride}"
63+
Content="Show Custom Chrome" Margin="5,0"/>
7164
</StackPanel>
7265

7366
<ContentControl x:Name="contentHolder" Margin="30,25,30,30"/>

src/shared/Core/UI/ViewModels/WindowViewModel.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace GitCredentialManager.UI.ViewModels
55
public class WindowViewModel : ViewModel
66
{
77
private bool _extendClientArea;
8-
private bool _showClientChromeOverride;
8+
private bool _showCustomChromeOverride;
99
private bool _showDebugControls;
1010
private string _title;
1111

@@ -16,8 +16,8 @@ public WindowViewModel()
1616
{
1717
Title = Constants.DefaultWindowTitle;
1818

19-
// Default to hiding the system chrome on macOS only for now
20-
ExtendClientArea = PlatformUtils.IsMacOS();
19+
// Extend the client area on Windows and macOS only
20+
ExtendClientArea = PlatformUtils.IsMacOS() || PlatformUtils.IsWindows();
2121
}
2222

2323
public bool WindowResult { get; private set; }
@@ -30,15 +30,17 @@ public bool ShowDebugControls
3030

3131
public bool ShowCustomChrome
3232
{
33-
get => ShowClientChromeOverride || (ExtendClientArea && !PlatformUtils.IsMacOS());
33+
// On macOS we typically do NOT want to show the custom chrome if we've extended the client area
34+
// because the native 'traffic light' controls will still be visible and we don't want to show our own.
35+
get => ShowCustomChromeOverride || (ExtendClientArea && !PlatformUtils.IsMacOS());
3436
}
3537

36-
public bool ShowClientChromeOverride
38+
public bool ShowCustomChromeOverride
3739
{
38-
get => _showClientChromeOverride;
40+
get => _showCustomChromeOverride;
3941
set
4042
{
41-
SetAndRaisePropertyChanged(ref _showClientChromeOverride, value);
43+
SetAndRaisePropertyChanged(ref _showCustomChromeOverride, value);
4244
RaisePropertyChanged(nameof(ShowCustomChrome));
4345
}
4446
}

0 commit comments

Comments
 (0)