internal/ui: bug fix: fullscreening didn't work correctly on macOS 13

As of macOS 13, a retrieved collectionBehavior included
NSWindowCollectionBehaviorFullScreenNone and this prevented the window
from being fullscreen.

This change fixes this issue by removing the flag
NSWindowCollectionBehaviorFullScreenNone when necessary.

Closes #2437
This commit is contained in:
Hajime Hoshi 2022-11-05 14:06:59 +09:00
parent aecbf2344d
commit ca1044ff33

View File

@ -149,13 +149,17 @@ package ui
//
// // Even though EbitenWindowDelegate is used, this hack is still required.
// // toggleFullscreen doesn't work when the window is not resizable.
// bool origFullscreen = window.collectionBehavior & NSWindowCollectionBehaviorFullScreenPrimary;
// NSUInteger origCollectionBehavior = window.collectionBehavior;
// bool origFullscreen = origCollectionBehavior & NSWindowCollectionBehaviorFullScreenPrimary;
// if (!origFullscreen) {
// window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
// NSUInteger collectionBehavior = origCollectionBehavior;
// collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
// collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenNone;
// window.collectionBehavior = collectionBehavior;
// }
// [window toggleFullScreen:nil];
// if (!origFullscreen) {
// window.collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
// window.collectionBehavior = origCollectionBehavior;
// }
// }
//
@ -257,11 +261,14 @@ package ui
//
// static void setAllowFullscreen(uintptr_t windowPtr, bool allowFullscreen) {
// NSWindow* window = (NSWindow*)windowPtr;
// uint collectionBehavior = 0;
// if (allowFullscreen) {
// window.collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
// collectionBehavior |= NSWindowCollectionBehaviorManaged;
// collectionBehavior |= NSWindowCollectionBehaviorFullScreenPrimary;
// } else {
// window.collectionBehavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
// collectionBehavior |= NSWindowCollectionBehaviorFullScreenNone;
// }
// window.collectionBehavior = collectionBehavior;
// }
import "C"