[vlc-devel] [PATCH 2/2] vout/macosx: Do not check call to disableScreenUpdatesUntilFlush

Marvin Scholz epirat07 at gmail.com
Tue Jan 30 15:51:37 CET 2018


NSWindows disableScreenUpdatesUntilFlush is available since macOS 10.4,
so there is no need to check if NSWindow responds to it.

Additionally clarify the comment about why it is there by replacing it
with a comment taken from Apple sample code that explains it very well.
---
 modules/video_output/macosx.m | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index d527f2f819..50dc4b68df 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -713,11 +713,15 @@ - (void)drawRect:(NSRect) rect
 
 - (void)renewGState
 {
-    NSWindow *window = [self window];
-
-    // Remove flashes with splitter view.
-    if ([window respondsToSelector:@selector(disableScreenUpdatesUntilFlush)])
-        [window disableScreenUpdatesUntilFlush];
+    // Comment take from Apple GLEssentials sample code:
+    // https://developer.apple.com/library/content/samplecode/GLEssentials
+    //
+    // OpenGL rendering is not synchronous with other rendering on the OSX.
+    // Therefore, call disableScreenUpdatesUntilFlush so the window server
+    // doesn't render non-OpenGL content in the window asynchronously from
+    // OpenGL content, which could cause flickering.  (non-OpenGL content
+    // includes the title bar and drawing done by the app with other APIs)
+    [[self window] disableScreenUpdatesUntilFlush];
 
     [super renewGState];
 }
-- 
2.14.3 (Apple Git-98)



More information about the vlc-devel mailing list