VideoOutputView registers for window resize notification it's in so it can update it's drawable object
This commit is contained in:
parent
1097dec1c6
commit
0f35f0e41d
|
@ -160,15 +160,22 @@
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
- (void)viewDidMoveToWindow
|
- (void)viewDidMoveToWindow
|
||||||
{
|
{//if the view moves to another window we need to update the drawable object
|
||||||
//the setView message doesnt work if the view
|
|
||||||
//isn't in a window, which is the case in the init func
|
if(!context)return;
|
||||||
//so we use this callback to bind the context to the window
|
|
||||||
|
//withdraw from recieving updates on previously window, if any
|
||||||
|
[[NSNotificationCenter defaultCenter] removeObserver:context];
|
||||||
|
|
||||||
if([self window] != nil)
|
if([self window] != nil)
|
||||||
|
{
|
||||||
[context setView:self];
|
[context setView:self];
|
||||||
else
|
|
||||||
[context clearDrawable];
|
//udpate drawable if the window changed
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserver:context selector:@selector(update) name:@"NSWindowDidResizeNotification" object:[self window]];
|
||||||
|
|
||||||
|
} else [context clearDrawable];
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -198,8 +205,8 @@
|
||||||
{
|
{
|
||||||
[super setFrame:rect];
|
[super setFrame:rect];
|
||||||
|
|
||||||
[context update];
|
|
||||||
[context makeCurrentContext];
|
[context makeCurrentContext];
|
||||||
|
[context update];
|
||||||
|
|
||||||
//set the viewport (so the raster pos will be correct)
|
//set the viewport (so the raster pos will be correct)
|
||||||
glViewport(0, 0, rect.size.width, rect.size.height);
|
glViewport(0, 0, rect.size.width, rect.size.height);
|
||||||
|
@ -275,6 +282,7 @@
|
||||||
[screen_buffer rotateTo0];
|
[screen_buffer rotateTo0];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
|
|
Loading…
Reference in New Issue