From e696ac4046878b68b123d3b2eaa0ce5867b29a82 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 13 Jan 2023 22:05:06 +0100 Subject: [PATCH] cocoa: Fix black bar when switching to fullscreen while z-order is top --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 8517dd4136..f65e97a0cc 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -851,7 +851,12 @@ set_properties_now(WindowProperties &properties) { if (switched) { if (_window != nil) { // For some reason, setting the style mask makes it give up its - // first-responder status. + // first-responder status. And for some reason, we need to first + // restore the window to normal level before we switch fullscreen, + // otherwise we may get a black bar if we're currently on Z_top. + if (_properties.get_z_order() != WindowProperties::Z_normal) { + [_window setLevel: NSNormalWindowLevel]; + } if ([_window respondsToSelector:@selector(setStyleMask:)]) { [_window setStyleMask:NSBorderlessWindowMask]; }