[vlc-commits] vout/macosx: Do not check call to disableScreenUpdatesUntilFlush

Marvin Scholz git at videolan.org
Fri Feb 2 13:04:49 CET 2018


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Jan 30 15:46:59 2018 +0100| [64ec400081755265ebb8e233192b9a01d61f54a7] | committer: Marvin Scholz

vout/macosx: Do not check call to disableScreenUpdatesUntilFlush

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=64ec400081755265ebb8e233192b9a01d61f54a7
---

 modules/video_output/macosx.m | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules/video_output/macosx.m b/modules/video_output/macosx.m
index d527f2f819..0ab61fc52b 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -713,11 +713,18 @@ static void OpenglSwap (vlc_gl_t *gl)
 
 - (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)
+
+    // In macOS 10.13 and later, window updates are automatically batched
+    // together and this no longer needs to be called (effectively a no-op)
+    [[self window] disableScreenUpdatesUntilFlush];
 
     [super renewGState];
 }



More information about the vlc-commits mailing list