Commit 61d49645 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: removed explicit 10.5 compatibility code

parent 5e674f08
...@@ -25,67 +25,9 @@ ...@@ -25,67 +25,9 @@
#pragma mark - #pragma mark -
#pragma OS detection code #pragma OS detection code
#define OSX_LEOPARD (NSAppKitVersionNumber < 1038 && NSAppKitVersionNumber >= 949)
#define OSX_SNOW_LEOPARD (NSAppKitVersionNumber < 1115 && NSAppKitVersionNumber >= 1038) #define OSX_SNOW_LEOPARD (NSAppKitVersionNumber < 1115 && NSAppKitVersionNumber >= 1038)
#define OSX_LION NSAppKitVersionNumber >= 1115.2 #define OSX_LION NSAppKitVersionNumber >= 1115.2
#pragma mark -
#pragma Fixes for OS X Leopard (10.5)
#ifndef MAC_OS_X_VERSION_10_6
@protocol NSAnimationDelegate <NSObject> @end
@protocol NSApplicationDelegate <NSObject> @end
@protocol NSWindowDelegate <NSObject> @end
@protocol NSComboBoxDataSource <NSObject> @end
@protocol NSTextFieldDelegate <NSObject> @end
@protocol NSTableViewDataSource <NSObject> @end
@protocol NSOutlineViewDelegate <NSObject> @end
@protocol NSOutlineViewDataSource <NSObject> @end
@protocol NSToolbarDelegate <NSObject> @end
@protocol NSSplitViewDelegate <NSObject> @end
enum {
NSApplicationPresentationDefault = 0,
NSApplicationPresentationAutoHideDock = (1 << 0),
NSApplicationPresentationHideDock = (1 << 1),
NSApplicationPresentationAutoHideMenuBar = (1 << 2),
NSApplicationPresentationHideMenuBar = (1 << 3),
NSApplicationPresentationDisableAppleMenu = (1 << 4),
NSApplicationPresentationDisableProcessSwitching = (1 << 5),
NSApplicationPresentationDisableForceQuit = (1 << 6),
NSApplicationPresentationDisableSessionTermination = (1 << 7),
NSApplicationPresentationDisableHideApplication = (1 << 8),
NSApplicationPresentationDisableMenuBarTransparency = (1 << 9)
};
typedef NSUInteger NSApplicationPresentationOptions;
#if defined( __LP64__) && !defined(__POWER__) /* Bug in the 10.5.sdk in 64bits */
extern OSErr UpdateSystemActivity(UInt8 activity);
#define UsrActivity 1
#endif
/* the following is just to fix warnings, not for implementation! */
@interface NSMenu (IntroducedInSnowLeopard)
- (void)removeAllItems;
@end
@interface NSApplication (IntroducedInSnowLeopard)
- (NSApplicationPresentationOptions)presentationOptions;
- (void)setPresentationOptions:(NSApplicationPresentationOptions)newOptions;
- (NSApplicationPresentationOptions)currentSystemPresentationOptions;
@end
@interface NSURL (IntroducedInSnowLeopard)
- (NSArray *)pathComponents;
@end
@interface NSCursor (IntroducedInSnowLeopard)
+ (NSCursor *)dragCopyCursor;
@end
#endif
#pragma mark - #pragma mark -
#pragma Fixes for OS X Snow Leopard (10.6) #pragma Fixes for OS X Snow Leopard (10.6)
......
...@@ -493,9 +493,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -493,9 +493,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
vlc_object_release( p_input ); vlc_object_release( p_input );
} }
else else
{
[o_mi_record setEnabled: NO]; [o_mi_record setEnabled: NO];
}
} }
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification - (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
...@@ -503,16 +501,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -503,16 +501,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
NSUInteger count = [o_mu_screen numberOfItems]; NSUInteger count = [o_mu_screen numberOfItems];
NSMenu * o_submenu = o_mu_screen; NSMenu * o_submenu = o_mu_screen;
if (count > 0) if (count > 0)
{ [o_submenu removeAllItems];
if (OSX_LEOPARD)
{
NSUInteger count = [o_submenu numberOfItems];
for( NSUInteger i = 0; i < count; i++ )
[o_submenu removeItemAtIndex: 0];
}
else
[o_submenu removeAllItems];
}
NSArray * o_screens = [NSScreen screens]; NSArray * o_screens = [NSScreen screens];
NSMenuItem * o_mitem; NSMenuItem * o_mitem;
...@@ -1064,18 +1053,8 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1064,18 +1053,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
int i_type, i; int i_type, i;
/* remove previous items */ /* remove previous items */
if (OSX_LEOPARD) [o_menu removeAllItems];
{
int i_nb_items;
i_nb_items = [o_menu numberOfItems];
for( i = 0; i < i_nb_items; i++ )
[o_menu removeItemAtIndex: 0];
}
else
{
/* this is more efficient then the legacy code, but 10.6+ only */
[o_menu removeAllItems];
}
/* we disable everything here, and enable it again when needed, below */ /* we disable everything here, and enable it again when needed, below */
[o_parent setEnabled:NO]; [o_parent setEnabled:NO];
...@@ -1108,7 +1087,7 @@ static VLCMainMenu *_o_sharedInstance = nil; ...@@ -1108,7 +1087,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
if( i_type & VLC_VAR_HASCHOICE ) if( i_type & VLC_VAR_HASCHOICE )
{ {
var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL ); var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 ) if( val.i_int == 0 )
return; return;
if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 ) if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
return; return;
......
...@@ -177,9 +177,6 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -177,9 +177,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_detached_video_window setDelegate: self]; [o_detached_video_window setDelegate: self];
[self useOptimizedDrawing: YES]; [self useOptimizedDrawing: YES];
if (!OSX_LEOPARD)
[o_right_split_view setWantsLayer:YES];
[o_play_btn setToolTip: _NS("Play/Pause")]; [o_play_btn setToolTip: _NS("Play/Pause")];
[o_detached_play_btn setToolTip: [o_play_btn toolTip]]; [o_detached_play_btn setToolTip: [o_play_btn toolTip]];
[o_bwd_btn setToolTip: _NS("Backward")]; [o_bwd_btn setToolTip: _NS("Backward")];
...@@ -935,23 +932,17 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -935,23 +932,17 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)resizePlaylistAfterCollapse - (void)resizePlaylistAfterCollapse
{ {
id o_playlist_viewitem;
if (OSX_LEOPARD)
o_playlist_viewitem = o_playlist_table;
else
o_playlist_viewitem = [o_playlist_table animator];
NSRect plrect; NSRect plrect;
plrect = [o_playlist_table frame]; plrect = [o_playlist_table frame];
plrect.size.height = i_lastSplitViewHeight - 19.0; // actual pl top bar height, which differs from its frame plrect.size.height = i_lastSplitViewHeight - 19.0; // actual pl top bar height, which differs from its frame
[o_playlist_viewitem setFrame: plrect]; [[o_playlist_table animator] setFrame: plrect];
NSRect rightSplitRect; NSRect rightSplitRect;
rightSplitRect = [o_right_split_view frame]; rightSplitRect = [o_right_split_view frame];
plrect = [o_dropzone_box frame]; plrect = [o_dropzone_box frame];
plrect.origin.x = (rightSplitRect.size.width - plrect.size.width) / 2; plrect.origin.x = (rightSplitRect.size.width - plrect.size.width) / 2;
plrect.origin.y = (rightSplitRect.size.height - plrect.size.height) / 2; plrect.origin.y = (rightSplitRect.size.height - plrect.size.height) / 2;
[o_playlist_viewitem setFrame: plrect]; [[o_playlist_table animator] setFrame: plrect];
} }
- (void)makeSplitViewVisible - (void)makeSplitViewVisible
...@@ -969,9 +960,6 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -969,9 +960,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight; new_frame.origin.y = old_frame.origin.y + old_frame.size.height - newHeight;
new_frame.size.height = newHeight; new_frame.size.height = newHeight;
if (OSX_LEOPARD)
[self setFrame: new_frame display: YES animate: YES];
else
[[self animator] setFrame: new_frame display: YES animate: YES]; [[self animator] setFrame: new_frame display: YES animate: YES];
} }
...@@ -1424,20 +1412,14 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1424,20 +1412,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_dropzone_active = YES; b_dropzone_active = YES;
[o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table]; [o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table];
[o_dropzone_view setFrame: [o_playlist_table frame]]; [o_dropzone_view setFrame: [o_playlist_table frame]];
if (OSX_LEOPARD) [[o_playlist_table animator] setHidden:YES];
[o_playlist_table setHidden:YES];
else
[[o_playlist_table animator] setHidden:YES];
} }
- (void)hideDropZone - (void)hideDropZone
{ {
b_dropzone_active = NO; b_dropzone_active = NO;
[o_dropzone_view removeFromSuperview]; [o_dropzone_view removeFromSuperview];
if (OSX_LEOPARD) [[o_playlist_table animator] setHidden: NO];
[o_playlist_table setHidden: NO];
else
[[o_playlist_table animator] setHidden: NO];
} }
- (void)hideSplitView - (void)hideSplitView
...@@ -1726,9 +1708,6 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1726,9 +1708,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)drawFancyGradientEffectForTimeSlider - (void)drawFancyGradientEffectForTimeSlider
{ {
if (OSX_LEOPARD)
return;
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
CGFloat f_value = [o_time_sld knobPosition]; CGFloat f_value = [o_time_sld knobPosition];
if (f_value > 7.5) if (f_value > 7.5)
...@@ -1964,10 +1943,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -1964,10 +1943,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( right_window_point > right_screen_point ) if( right_window_point > right_screen_point )
new_frame.origin.x -= ( right_window_point - right_screen_point ); new_frame.origin.x -= ( right_window_point - right_screen_point );
if (OSX_LEOPARD) [[o_videoWindow animator] setFrame:new_frame display:YES];
[o_videoWindow setFrame:new_frame display:YES];
else
[[o_videoWindow animator] setFrame:new_frame display:YES];
} }
- (void)setNativeVideoSize:(NSSize)size - (void)setNativeVideoSize:(NSSize)size
...@@ -2095,12 +2071,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2095,12 +2071,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
if ([screen isMainScreen]) if ([screen isMainScreen])
{ [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
[[o_video_view superview] replaceSubview:o_video_view with:o_temp_view]; [[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
[o_temp_view setFrame:[o_video_view frame]]; [o_temp_view setFrame:[o_video_view frame]];
...@@ -2155,12 +2126,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2155,12 +2126,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
if ([screen isMainScreen]) if ([screen isMainScreen])
{ [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
dict1 = [[NSMutableDictionary alloc] initWithCapacity:2]; dict1 = [[NSMutableDictionary alloc] initWithCapacity:2];
dict2 = [[NSMutableDictionary alloc] initWithCapacity:3]; dict2 = [[NSMutableDictionary alloc] initWithCapacity:3];
...@@ -2269,10 +2235,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2269,10 +2235,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
} }
[o_fspanel setNonActive: nil]; [o_fspanel setNonActive: nil];
if (OSX_LEOPARD) [NSApp setPresentationOptions: NSApplicationPresentationDefault];
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
/* Will release the lock */ /* Will release the lock */
[self hasEndedFullscreen]; [self hasEndedFullscreen];
...@@ -2295,10 +2258,7 @@ static VLCMainWindow *_o_sharedInstance = nil; ...@@ -2295,10 +2258,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[o_video_view window] orderFront: self]; [[o_video_view window] orderFront: self];
[o_fspanel setNonActive: nil]; [o_fspanel setNonActive: nil];
if (OSX_LEOPARD) [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
if (o_fullscreen_anim1) if (o_fullscreen_anim1)
{ {
......
...@@ -54,10 +54,6 @@ unsigned int CocoaKeyToVLC( unichar i_key ); ...@@ -54,10 +54,6 @@ unsigned int CocoaKeyToVLC( unichar i_key );
* the translated string. the translation should be '1:translatedstring' though */ * the translated string. the translation should be '1:translatedstring' though */
#define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2] #define _ANS(s) [[[VLCMain sharedInstance] localizedString: _(s)] substringFromIndex:2]
#define MACOS_VERSION [[[NSDictionary dictionaryWithContentsOfFile: \
@"/System/Library/CoreServices/SystemVersion.plist"] \
objectForKey: @"ProductVersion"] floatValue]
// You need to release those objects after use // You need to release those objects after use
input_thread_t *getInput(void); input_thread_t *getInput(void);
......
...@@ -234,12 +234,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -234,12 +234,7 @@ static NSMutableArray *blackoutWindows = NULL;
[blackoutWindow release]; [blackoutWindow release];
if( [screen isMainScreen] ) if( [screen isMainScreen] )
{ [NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
} }
} }
...@@ -253,10 +248,7 @@ static NSMutableArray *blackoutWindows = NULL; ...@@ -253,10 +248,7 @@ static NSMutableArray *blackoutWindows = NULL;
[blackoutWindow closeAndAnimate: YES]; [blackoutWindow closeAndAnimate: YES];
} }
if (OSX_LEOPARD) [NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
} }
@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