[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:
parent
fb9684e0f1
commit
52a9869596
@ -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;
|
||||||
|
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user