diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 30fd3beeef9..bab000f4e4b 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -275,10 +275,13 @@ case SystemDecorationsFull: [Window setHasShadow:YES]; - [Window setTitleVisibility:NSWindowTitleVisible]; - [Window setTitlebarAppearsTransparent:NO]; [Window setTitle:_lastTitle]; + if (!_isClientAreaExtended) { + [Window setTitleVisibility:NSWindowTitleVisible]; + [Window setTitlebarAppearsTransparent:NO]; + } + if (currentWindowState == Maximized) { auto newFrame = [Window contentRectForFrameRect:[Window frame]].size; @@ -605,7 +608,8 @@ } bool wantsChrome = (_extendClientHints & AvnSystemChrome) || (_extendClientHints & AvnPreferSystemChrome); - bool hasTrafficLights = _isClientAreaExtended ? wantsChrome : _decorations == SystemDecorationsFull; + bool hasTrafficLights = (_decorations == SystemDecorationsFull) && + (_isClientAreaExtended ? wantsChrome : true); NSButton* closeButton = [Window standardWindowButton:NSWindowCloseButton]; NSButton* miniaturizeButton = [Window standardWindowButton:NSWindowMiniaturizeButton]; diff --git a/samples/IntegrationTestApp/MainWindow.axaml b/samples/IntegrationTestApp/MainWindow.axaml index 7fc87f1b697..c00ccc70e10 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml +++ b/samples/IntegrationTestApp/MainWindow.axaml @@ -120,6 +120,12 @@ Maximized FullScreen + + None + BorderOnly + Full + + ExtendClientAreaToDecorationsHint Can Resize diff --git a/samples/IntegrationTestApp/MainWindow.axaml.cs b/samples/IntegrationTestApp/MainWindow.axaml.cs index 3f9913f3ac6..f4f27d34c9f 100644 --- a/samples/IntegrationTestApp/MainWindow.axaml.cs +++ b/samples/IntegrationTestApp/MainWindow.axaml.cs @@ -60,6 +60,8 @@ private void ShowWindow() var locationComboBox = this.GetControl("ShowWindowLocation"); var stateComboBox = this.GetControl("ShowWindowState"); var size = !string.IsNullOrWhiteSpace(sizeTextBox.Text) ? Size.Parse(sizeTextBox.Text) : (Size?)null; + var systemDecorations = this.GetControl("ShowWindowSystemDecorations"); + var extendClientArea = this.GetControl("ShowWindowExtendClientAreaToDecorationsHint"); var canResizeCheckBox = this.GetControl("ShowWindowCanResize"); var owner = (Window)this.GetVisualRoot()!; @@ -86,6 +88,8 @@ private void ShowWindow() } sizeTextBox.Text = string.Empty; + window.ExtendClientAreaToDecorationsHint = extendClientArea.IsChecked ?? false; + window.SystemDecorations = (SystemDecorations)systemDecorations.SelectedIndex; window.WindowState = (WindowState)stateComboBox.SelectedIndex; switch (modeComboBox.SelectedIndex) diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml b/samples/IntegrationTestApp/ShowWindowTest.axaml index ae46c92431b..7c8cfd4553c 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml @@ -1,16 +1,18 @@ - - - - - - + + + + + + + @@ -21,20 +23,37 @@ - - - - - - Normal - Minimized - Maximized - FullScreen - - - - - - - + + + + + + Normal + Minimized + Maximized + FullScreen + + + + + None + BorderOnly + Full + + + + ExtendClientAreaToDecorationsHint + + + + + + + diff --git a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs index 43875dd9909..00e44b85930 100644 --- a/samples/IntegrationTestApp/ShowWindowTest.axaml.cs +++ b/samples/IntegrationTestApp/ShowWindowTest.axaml.cs @@ -7,6 +7,25 @@ namespace IntegrationTestApp { + public class MeasureBorder : Border + { + protected override Size MeasureOverride(Size availableSize) + { + MeasuredWith = availableSize; + + return base.MeasureOverride(availableSize); + } + + public static readonly StyledProperty MeasuredWithProperty = AvaloniaProperty.Register( + nameof(MeasuredWith)); + + public Size MeasuredWith + { + get => GetValue(MeasuredWithProperty); + set => SetValue(MeasuredWithProperty, value); + } + } + public class ShowWindowTest : Window { private readonly DispatcherTimer? _timer;