diff --git a/panda/src/cocoadisplay/cocoaPandaView.mm b/panda/src/cocoadisplay/cocoaPandaView.mm index c3471ec36b..6a3f48b39a 100644 --- a/panda/src/cocoadisplay/cocoaPandaView.mm +++ b/panda/src/cocoadisplay/cocoaPandaView.mm @@ -26,6 +26,10 @@ [self setCanDrawConcurrently:YES]; #endif + // If a layer ends up becoming attached to the view, tell AppKit we'll manage + // the redrawing since we're doing things our own way. + self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawNever; + cocoadisplay_cat.debug() << "Created CocoaPandaView " << self << " for GraphicsWindow " << window << "\n"; _graphicsWindow = window; @@ -167,4 +171,15 @@ - (BOOL) isOpaque { return YES; } + +-(void)setLayer:(CALayer*)layer +{ + [super setLayer:layer]; + + // Starting in macOS 10.14, a CALayer will still be attached to a view even + // if `wantsLayer` is false. If we don't update the context now, only a + // black screen will be rendered until the context is updated some other + // way (like through a window resize event). + [_context update]; +} @end