From 1abb1abaf5f03ee87f66946acc3b2fc709a45d73 Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 8 Feb 2023 10:42:17 +0100 Subject: [PATCH] Don't overwrite unrelated style mask bits. Fixes a problem where we were clearing the fullscreen flag erroneously during a fullscreen transition, and in general it's best to preserve flags we're not interested in controlling anyway. --- native/Avalonia.Native/src/OSX/WindowImpl.mm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index 4510d135dc..cf1ee6943d 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -561,13 +561,15 @@ bool WindowImpl::IsOwned() { } NSWindowStyleMask WindowImpl::CalculateStyleMask() { - unsigned long s = NSWindowStyleMaskBorderless; + // Use the current style mask and only clear the flags we're going to be modifying. + unsigned long s = [Window styleMask] & + ~(NSWindowStyleMaskFullSizeContentView | + NSWindowStyleMaskTitled | + NSWindowStyleMaskClosable | + NSWindowStyleMaskResizable | + NSWindowStyleMaskMiniaturizable | + NSWindowStyleMaskTexturedBackground); - if(_actualWindowState == FullScreen) - { - s |= NSWindowStyleMaskFullScreen; - } - switch (_decorations) { case SystemDecorationsNone: s = s | NSWindowStyleMaskFullSizeContentView;