From 32265d7e4ebac9b566610bb877a23890b8705804 Mon Sep 17 00:00:00 2001 From: Matthieu Bouron Date: Fri, 8 Nov 2013 12:12:26 +0000 Subject: [PATCH] [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 --- gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h | 1 - gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m | 23 ++++++++------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h b/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h index 13577e34ce..4510cb2a5d 100644 --- a/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h +++ b/gst-libs/gst/gl/cocoa/gstgl_cocoa_private.h @@ -66,7 +66,6 @@ struct _GstGLContextCocoaPrivate @interface GstGLNSOpenGLView: NSOpenGLView { GstGLWindowCocoa *m_cocoa; - gint m_resizeCount; } - (id) initWithFrame:(GstGLWindowCocoa *)window rect:(NSRect)contentRect pixelFormat:(NSOpenGLPixelFormat *)fmt; diff --git a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m index 93357ec81e..564cc2fcd5 100644 --- a/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m +++ b/gst-libs/gst/gl/cocoa/gstglwindow_cocoa.m @@ -449,7 +449,6 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window, self = [super initWithFrame: contentRect pixelFormat: fmt]; m_cocoa = window; - m_resizeCount = 0; #ifndef GNUSTEP [self setWantsLayer:NO]; @@ -463,23 +462,19 @@ gst_gl_window_cocoa_send_message_async (GstGLWindow * window, window = GST_GL_WINDOW (m_cocoa); - if (m_resizeCount % 5 == 0) { - m_resizeCount = 0; - if (window->resize) { + if (window->resize) { - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - NSRect bounds = [self bounds]; - AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc] - initWithSize:m_cocoa callback:window->resize userData:window->resize_data - toSize:bounds.size]; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSRect bounds = [self bounds]; + AppThreadPerformer* app_thread_performer = [[AppThreadPerformer alloc] + initWithSize:m_cocoa callback:window->resize userData:window->resize_data + toSize:bounds.size]; - [app_thread_performer performSelector:@selector(resizeWindow) onThread:m_cocoa->priv->thread - withObject:nil waitUntilDone:YES]; + [app_thread_performer performSelector:@selector(resizeWindow) onThread:m_cocoa->priv->thread + withObject:nil waitUntilDone:YES]; - [pool release]; - } + [pool release]; } - m_resizeCount++; } - (void) update {