From 46c93c9cc984b99142b6e7321c8f5c4c8c4e65bb Mon Sep 17 00:00:00 2001 From: Pierre d'Herbemont Date: Sun, 12 Apr 2009 14:31:50 -0700 Subject: [PATCH] gui/*macosx: Don't rely on carbon or on old non 64 bits API when possible. --- modules/gui/macosx/embeddedwindow.m | 27 ++++++------------- modules/gui/macosx/vout.m | 9 +++---- .../gui/minimal_macosx/VLCMinimalVoutWindow.m | 7 ++--- 3 files changed, 13 insertions(+), 30 deletions(-) diff --git a/modules/gui/macosx/embeddedwindow.m b/modules/gui/macosx/embeddedwindow.m index 2ffaa3ba02..e2ff658dc2 100644 --- a/modules/gui/macosx/embeddedwindow.m +++ b/modules/gui/macosx/embeddedwindow.m @@ -26,9 +26,6 @@ * Preamble *****************************************************************************/ -/* DisableScreenUpdates, SetSystemUIMode, ... */ -#import - #import "intf.h" #import "controls.h" #import "vout.h" @@ -287,7 +284,7 @@ CGDisplayFade( token, 0.5, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES ); if ([screen isMainScreen]) - SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:NO]; [[self contentView] replaceSubview:o_view with:o_temp_view]; [o_temp_view setFrame:[o_view frame]]; @@ -308,16 +305,12 @@ } /* Make sure we don't see the o_view disappearing of the screen during this operation */ - #ifndef __x86_64__ - DisableScreenUpdates(); - #endif + NSEnableScreenUpdates(); [[self contentView] replaceSubview:o_view with:o_temp_view]; [o_temp_view setFrame:[o_view frame]]; [o_fullscreen_window setContentView:o_view]; [o_fullscreen_window makeKeyAndOrderFront:self]; - #ifndef __x86_64__ - EnableScreenUpdates(); - #endif + NSDisableScreenUpdates(); } /* We are in fullscreen (and no animation is running) */ @@ -341,7 +334,7 @@ } if ([screen isMainScreen]) - SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:NO]; dict1 = [[NSMutableDictionary alloc] initWithCapacity:2]; dict2 = [[NSMutableDictionary alloc] initWithCapacity:3]; @@ -431,7 +424,7 @@ CGDisplayFade( token, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0, 0, 0, YES ); [[[[VLCMain sharedInstance] controls] fspanel] setNonActive: nil]; - SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:YES]; /* Will release the lock */ [self hasEndedFullscreen]; @@ -449,7 +442,7 @@ [self orderFront: self]; [[[[VLCMain sharedInstance] controls] fspanel] setNonActive: nil]; - SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:YES]; if (o_fullscreen_anim1) { @@ -504,9 +497,7 @@ { /* This function is private and should be only triggered at the end of the fullscreen change animation */ /* Make sure we don't see the o_view disappearing of the screen during this operation */ - #ifndef __x86_64__ - DisableScreenUpdates(); - #endif + NSDisableScreenUpdates(); [o_view retain]; [o_view removeFromSuperviewWithoutNeedingDisplay]; [[self contentView] replaceSubview:o_temp_view with:o_view]; @@ -516,9 +507,7 @@ if ([self isVisible]) [super makeKeyAndOrderFront:self]; /* our version contains a workaround */ [o_fullscreen_window orderOut: self]; - #ifndef __x86_64__ - EnableScreenUpdates(); - #endif + NSEnableScreenUpdates(); [o_fullscreen_window release]; o_fullscreen_window = nil; diff --git a/modules/gui/macosx/vout.m b/modules/gui/macosx/vout.m index 9027baf14d..224ed25f48 100644 --- a/modules/gui/macosx/vout.m +++ b/modules/gui/macosx/vout.m @@ -36,10 +36,6 @@ /* prevent system sleep */ #import -#import - -/* SystemUIMode */ -#import #include @@ -1117,7 +1113,7 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, [self setMovableByWindowBackground: NO]; if( [screen isMainScreen] ) - SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:NO]; initialFrame = [self frame]; [self setFrame:[screen frame] display:YES animate:YES]; @@ -1138,7 +1134,8 @@ int DeviceCallback( vlc_object_t *p_this, const char *psz_variable, [NSScreen unblackoutScreens]; [[[[VLCMain sharedInstance] controls] fspanel] setNonActive: nil]; - SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:YES]; + [self setFrame:initialFrame display:YES animate:YES]; [self setMovableByWindowBackground: YES]; if( var_GetBool( p_vout, "video-on-top" ) ) diff --git a/modules/gui/minimal_macosx/VLCMinimalVoutWindow.m b/modules/gui/minimal_macosx/VLCMinimalVoutWindow.m index f00b832058..8d998c9bf8 100644 --- a/modules/gui/minimal_macosx/VLCMinimalVoutWindow.m +++ b/modules/gui/minimal_macosx/VLCMinimalVoutWindow.m @@ -29,9 +29,6 @@ #include "VLCOpenGLVoutView.h" #include "VLCMinimalVoutWindow.h" -/* SetSystemUIMode, ... */ -#import - #import @implementation VLCMinimalVoutWindow @@ -67,14 +64,14 @@ { fullscreen = YES; initialFrame = [self frame]; - SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:NO]; [self setFrame:[[self screen] frame] display:YES animate:YES]; } - (void)leaveFullscreen { fullscreen = NO; - SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar); + [NSMenu setMenuBarVisible:YES]; [self setFrame:initialFrame display:YES animate:YES]; } -- 2.39.2