Partial fix for traditional full screen on Big Turd
This commit is contained in:
parent
e9a28550cc
commit
bdcac9aed3
2
glfw/cocoa_platform.h
vendored
2
glfw/cocoa_platform.h
vendored
@ -128,6 +128,8 @@ typedef struct _GLFWwindowNS
|
|||||||
|
|
||||||
bool maximized;
|
bool maximized;
|
||||||
bool retina;
|
bool retina;
|
||||||
|
bool in_traditional_fullscreen;
|
||||||
|
unsigned long pre_full_screen_style_mask;
|
||||||
|
|
||||||
// Cached window properties to filter out duplicate events
|
// Cached window properties to filter out duplicate events
|
||||||
int width, height;
|
int width, height;
|
||||||
|
|||||||
@ -2062,18 +2062,38 @@ bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
|
|||||||
bool made_fullscreen = true;
|
bool made_fullscreen = true;
|
||||||
bool traditional = !(flags & 1);
|
bool traditional = !(flags & 1);
|
||||||
NSWindowStyleMask sm = [window styleMask];
|
NSWindowStyleMask sm = [window styleMask];
|
||||||
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
|
|
||||||
if (traditional) {
|
if (traditional) {
|
||||||
if (!(in_fullscreen)) {
|
if (@available(macOS 10.16, *)) {
|
||||||
sm |= NSWindowStyleMaskBorderless | NSWindowStyleMaskFullScreen;
|
// As of Big Turd NSWindowStyleMaskFullScreen is no longer useable
|
||||||
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
|
if (!w->ns.in_traditional_fullscreen) {
|
||||||
|
w->ns.pre_full_screen_style_mask = sm;
|
||||||
|
[window setStyleMask: NSWindowStyleMaskBorderless];
|
||||||
|
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
|
||||||
|
[window setFrame:[window.screen frame] display:YES];
|
||||||
|
w->ns.in_traditional_fullscreen = true;
|
||||||
|
} else {
|
||||||
|
made_fullscreen = false;
|
||||||
|
[window setStyleMask: w->ns.pre_full_screen_style_mask];
|
||||||
|
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationDefault];
|
||||||
|
w->ns.in_traditional_fullscreen = false;
|
||||||
|
}
|
||||||
|
// for some reason despite calling this selector, the window doesnt actually get keyboard focus till you click on it.
|
||||||
|
// presumably a bug with NSWindowStyleMaskBorderless windows
|
||||||
|
[window performSelector:@selector(makeKeyAndOrderFront:) withObject:nil afterDelay:0];
|
||||||
} else {
|
} else {
|
||||||
made_fullscreen = false;
|
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
|
||||||
sm &= ~(NSWindowStyleMaskBorderless | NSWindowStyleMaskFullScreen);
|
if (!(in_fullscreen)) {
|
||||||
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationDefault];
|
sm |= NSWindowStyleMaskBorderless | NSWindowStyleMaskFullScreen;
|
||||||
|
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock];
|
||||||
|
} else {
|
||||||
|
made_fullscreen = false;
|
||||||
|
sm &= ~(NSWindowStyleMaskBorderless | NSWindowStyleMaskFullScreen);
|
||||||
|
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationDefault];
|
||||||
|
}
|
||||||
|
[window setStyleMask: sm];
|
||||||
}
|
}
|
||||||
[window setStyleMask: sm];
|
|
||||||
} else {
|
} else {
|
||||||
|
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
|
||||||
if (in_fullscreen) made_fullscreen = false;
|
if (in_fullscreen) made_fullscreen = false;
|
||||||
[window toggleFullScreen: nil];
|
[window toggleFullScreen: nil];
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user