goe
goe

Reputation: 2303

NSOpenglView appears in front of NSView after deminimize window

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?

Upvotes: 2

Views: 185

Answers (1)

goe
goe

Reputation: 2303

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.

Upvotes: 2

Related Questions