2

I have a NSView displayed over a NSOpenGLView. I am using the 'setWantsLayer:YES' to force the NSView to appear over the opengl context. But when I minimize the window and deminimize it again, the NSView is no more over the NSOpenGLView.

Is there a way to prevent this behaviour?

goe
  • 2,272
  • 1
  • 19
  • 34

1 Answers1

2

Ok, I have found a solution for this issue. Is not maybe the best, but solves the issue.

First, I have declared a notifier in my appDelegate class:

[[NSNotificationCenter defaultCenter]
 addObserver:self
 selector:@selector(windowDidDeminiaturize:)
 name:NSWindowDidDeminiaturizeNotification object:nil];

This notifier detects the window deminimization event. Then, in the callback function, I do this:

- (void)windowDidDeminiaturize:(NSNotification *)notification
{
    [view_PlaybackView setWantsLayer:NO];
    [view_PlaybackView setWantsLayer:YES];
}

And the view is again shown in front of the NSOpenGLView.

goe
  • 2,272
  • 1
  • 19
  • 34
  • Nice! OS X 10.11.3 broke something to do with layered views when the app is miniaturized or hidden and your fix/workaround is the charm. – Perry Feb 10 '16 at 22:02