Browse Source

Disallow entering fullscreen when showing window. (#12865)

Fixes hard-to-reproduce problem when showing a window while on a fullscreen space.
pull/13087/head
Steven Kirk 2 years ago
committed by GitHub
parent
commit
965276d616
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

13
native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

@ -106,6 +106,17 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) {
[Window center];
}
// When showing a window, disallow fullscreen because if the window is being
// shown while another window is fullscreen, macOS will briefly transition this
// new window to fullscreen and then it will be transitioned back. This breaks
// input events for a short time as described in this issue:
//
// https://yt.avaloniaui.net/issue/OUTSYSTEMS-40
//
// We restore the collection behavior at the end of this method.
auto collectionBehavior = [Window collectionBehavior];
[Window setCollectionBehavior:collectionBehavior & ~NSWindowCollectionBehaviorFullScreenPrimary];
UpdateStyle();
[Window invalidateShadow];
@ -120,7 +131,7 @@ HRESULT WindowBaseImpl::Show(bool activate, bool isDialog) {
}
_shown = true;
[Window setCollectionBehavior:collectionBehavior];
return S_OK;
}
}

Loading…
Cancel
Save