[837/906] cocoa: resize OpenGL view size each time the window is resized

Fixes glitches that can appear when the OpenGL view has not been resized
after a window resize.

https://bugzilla.gnome.org/show_bug.cgi?id=711672
This commit is contained in:
Matthieu Bouron 2013-11-08 12:12:26 +00:00 committed by Matthew Waters
parent fb9684e0f1
commit 52a9869596
2 changed files with 9 additions and 15 deletions

View File

@ -66,7 +66,6 @@ struct _GstGLContextCocoaPrivate
@interface GstGLNSOpenGLView: NSOpenGLView { @interface GstGLNSOpenGLView: NSOpenGLView {
GstGLWindowCocoa *m_cocoa; GstGLWindowCocoa *m_cocoa;
gint m_resizeCount;
} }
- (id) initWithFrame:(GstGLWindowCocoa *)window rect:(NSRect)contentRect - (id) initWithFrame:(GstGLWindowCocoa *)window rect:(NSRect)contentRect
pixelFormat:(NSOpenGLPixelFormat *)fmt; pixelFormat:(NSOpenGLPixelFormat *)fmt;

View File

@ -449,7 +449,6 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
self = [super initWithFrame: contentRect pixelFormat: fmt]; self = [super initWithFrame: contentRect pixelFormat: fmt];
m_cocoa = window; m_cocoa = window;
m_resizeCount = 0;
#ifndef GNUSTEP #ifndef GNUSTEP
[self setWantsLayer:NO]; [self setWantsLayer:NO];
@ -463,23 +462,19 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window,
window = GST_GL_WINDOW (m_cocoa); window = GST_GL_WINDOW (m_cocoa);
if (m_resizeCount % 5 == 0) { if (window->resize) {
m_resizeCount = 0;
if (window->resize) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSRect bounds = [self bounds]; NSRect bounds = [self bounds];
AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc] AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc]
initWithSize:m_cocoa callback:window->resize userData:window->resize_data initWithSize:m_cocoa callback:window->resize userData:window->resize_data
toSize:bounds.size]; toSize:bounds.size];
[app_thread_performer performSelector:@selector(resizeWindow) onThread:m_cocoa->priv->thread [app_thread_performer performSelector:@selector(resizeWindow) onThread:m_cocoa->priv->thread
withObject:nil waitUntilDone:YES]; withObject:nil waitUntilDone:YES];
[pool release]; [pool release];
}
} }
m_resizeCount++;
} }
- (void) update { - (void) update {