From fe450dc4677b564013a6a4c2568488fbd319d48b Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sat, 11 Oct 2025 11:11:49 +0800 Subject: [PATCH 4/4] gui/minimal_macosx/VLCMinimalVoutWindow.m --- .../gui/minimal_macosx/VLCMinimalVoutWindow.m | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git modules/gui/minimal_macosx/VLCMinimalVoutWindow.m modules/gui/minimal_macosx/VLCMinimalVoutWindow.m index bd58f7d6e1..5214cc06fe 100644 --- modules/gui/minimal_macosx/VLCMinimalVoutWindow.m +++ modules/gui/minimal_macosx/VLCMinimalVoutWindow.m @@ -32,17 +32,19 @@ #import @implementation VLCMinimalVoutWindow + - (id)initWithContentRect:(NSRect)contentRect { - if( self = [super initWithContentRect:contentRect - styleMask:NSBorderlessWindowMask - backing:NSBackingStoreBuffered - defer:NO]) - { + self = [super initWithContentRect:contentRect + styleMask:NSBorderlessWindowMask + backing:NSBackingStoreBuffered + defer:NO]; + if (self) { initialFrame = contentRect; [self setBackgroundColor:[NSColor blackColor]]; [self setHasShadow:YES]; - [self setMovableByWindowBackground:YES]; + if ([self respondsToSelector:@selector(setMovableByWindowBackground:)]) + [self setMovableByWindowBackground:YES]; [self center]; } return self; @@ -51,21 +53,15 @@ - (void)enterFullscreen { NSScreen *screen = [self screen]; + if (!screen) + screen = [NSScreen mainScreen]; initialFrame = [self frame]; - [self setFrame:[[self screen] frame] display:YES animate:YES]; - - NSApplicationPresentationOptions presentationOpts = [NSApp presentationOptions]; - if ([screen hasMenuBar]) - presentationOpts |= NSApplicationPresentationAutoHideMenuBar; - if ([screen hasMenuBar] || [screen hasDock]) - presentationOpts |= NSApplicationPresentationAutoHideDock; - [NSApp setPresentationOptions:presentationOpts]; + [self setFrame:[screen frame] display:YES animate:YES]; } - (void)leaveFullscreen { - [NSApp setPresentationOptions: NSApplicationPresentationDefault]; [self setFrame:initialFrame display:YES animate:YES]; } -- 2.51.0