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

Marvin Scholz git at videolan.org
Fri Feb 2 15:57:33 CET 2018


vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Jan 30 15:46:59 2018 +0100| [96689d6992803d0807b5d345b18f1079626810d7] | committer: Jean-Baptiste Kempf

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.

(cherry picked from commit 64ec400081755265ebb8e233192b9a01d61f54a7)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=96689d6992803d0807b5d345b18f1079626810d7
---

 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 98e505cd00..050cc073a1 100644
--- a/modules/video_output/macosx.m
+++ b/modules/video_output/macosx.m
@@ -714,11 +714,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