[vlc-devel] [PATCH 2/2] vout/macosx: Do not check call to disableScreenUpdatesUntilFlush
Felix Paul Kühne
fkuehne at videolan.org
Fri Feb 2 11:58:36 CET 2018
Hi Marvin,
> On 30. Jan 2018, at 15:51, Marvin Scholz <epirat07 at gmail.com> wrote:
>
> 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];
We might want to amend the comment with the fact that in macOS 10.13 and later, "window updates are automatically batched together and disableScreenUpdatesUntilFlush no longer needs to be called; it is effectively a no-op.”
Removing the runtime check seems sane to me.
Best regards,
Felix
More information about the vlc-devel
mailing list