Commit f692f456 authored by David Fuhrmann's avatar David Fuhrmann Committed by Felix Paul Kühne

macosx vout: reliably set the window level

setLevel: seems to be not thread-safe, therefore we set this on the main thread to ensure its functionality
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
(cherry picked from commit e33b79f2)
parent 52b50d0c
...@@ -320,11 +320,10 @@ static int Control (vout_display_t *vd, int query, va_list ap) ...@@ -320,11 +320,10 @@ static int Control (vout_display_t *vd, int query, va_list ap)
} }
case VOUT_DISPLAY_CHANGE_WINDOW_STATE: case VOUT_DISPLAY_CHANGE_WINDOW_STATE:
{ {
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
unsigned state = va_arg (ap, unsigned); unsigned state = va_arg (ap, unsigned);
if( (state & VOUT_WINDOW_STATE_ABOVE) != 0) [sys->glView performSelectorOnMainThread:@selector(setWindowLevel:) withObject:[NSNumber numberWithUnsignedInt:state] waitUntilDone:NO];
[[sys->glView window] setLevel: NSStatusWindowLevel]; [o_pool release];
else
[[sys->glView window] setLevel: NSNormalWindowLevel];
return VLC_SUCCESS; return VLC_SUCCESS;
} }
case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED: case VOUT_DISPLAY_CHANGE_DISPLAY_FILLED:
...@@ -713,4 +712,12 @@ static void OpenglSwap(vlc_gl_t *gl) ...@@ -713,4 +712,12 @@ static void OpenglSwap(vlc_gl_t *gl)
{ {
return YES; return YES;
} }
- (void)setWindowLevel:(NSNumber*)state
{
if( [state unsignedIntValue] & VOUT_WINDOW_STATE_ABOVE )
[[self window] setLevel: NSStatusWindowLevel];
else
[[self window] setLevel: NSNormalWindowLevel];
}
@end @end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment