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 @@
#pragma mark -
#pragma OS detection code
#define OSX_LEOPARD (NSAppKitVersionNumber < 1038 && NSAppKitVersionNumber >= 949)
#define OSX_SNOW_LEOPARD (NSAppKitVersionNumber < 1115 && NSAppKitVersionNumber >= 1038)
#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 Fixes for OS X Snow Leopard (10.6)
......
......@@ -493,9 +493,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
vlc_object_release( p_input );
}
else
{
[o_mi_record setEnabled: NO];
}
}
- (void)refreshVoutDeviceMenu:(NSNotification *)o_notification
......@@ -503,16 +501,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
NSUInteger count = [o_mu_screen numberOfItems];
NSMenu * o_submenu = o_mu_screen;
if (count > 0)
{
if (OSX_LEOPARD)
{
NSUInteger count = [o_submenu numberOfItems];
for( NSUInteger i = 0; i < count; i++ )
[o_submenu removeItemAtIndex: 0];
}
else
[o_submenu removeAllItems];
}
[o_submenu removeAllItems];
NSArray * o_screens = [NSScreen screens];
NSMenuItem * o_mitem;
......@@ -1064,18 +1053,8 @@ static VLCMainMenu *_o_sharedInstance = nil;
int i_type, i;
/* remove previous items */
if (OSX_LEOPARD)
{
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];
}
[o_menu removeAllItems];
/* we disable everything here, and enable it again when needed, below */
[o_parent setEnabled:NO];
......@@ -1108,7 +1087,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
if( i_type & VLC_VAR_HASCHOICE )
{
var_Change( p_object, psz_variable, VLC_VAR_CHOICESCOUNT, &val, NULL );
if( val.i_int == 0 )
if( val.i_int == 0 )
return;
if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
return;
......
......@@ -177,9 +177,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_detached_video_window setDelegate: self];
[self useOptimizedDrawing: YES];
if (!OSX_LEOPARD)
[o_right_split_view setWantsLayer:YES];
[o_play_btn setToolTip: _NS("Play/Pause")];
[o_detached_play_btn setToolTip: [o_play_btn toolTip]];
[o_bwd_btn setToolTip: _NS("Backward")];
......@@ -935,23 +932,17 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (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;
plrect = [o_playlist_table 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;
rightSplitRect = [o_right_split_view frame];
plrect = [o_dropzone_box frame];
plrect.origin.x = (rightSplitRect.size.width - plrect.size.width) / 2;
plrect.origin.y = (rightSplitRect.size.height - plrect.size.height) / 2;
[o_playlist_viewitem setFrame: plrect];
[[o_playlist_table animator] setFrame: plrect];
}
- (void)makeSplitViewVisible
......@@ -969,9 +960,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
new_frame.origin.y = old_frame.origin.y + old_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];
}
......@@ -1424,20 +1412,14 @@ static VLCMainWindow *_o_sharedInstance = nil;
b_dropzone_active = YES;
[o_right_split_view addSubview: o_dropzone_view positioned:NSWindowAbove relativeTo:o_playlist_table];
[o_dropzone_view setFrame: [o_playlist_table frame]];
if (OSX_LEOPARD)
[o_playlist_table setHidden:YES];
else
[[o_playlist_table animator] setHidden:YES];
[[o_playlist_table animator] setHidden:YES];
}
- (void)hideDropZone
{
b_dropzone_active = NO;
[o_dropzone_view removeFromSuperview];
if (OSX_LEOPARD)
[o_playlist_table setHidden: NO];
else
[[o_playlist_table animator] setHidden: NO];
[[o_playlist_table animator] setHidden: NO];
}
- (void)hideSplitView
......@@ -1726,9 +1708,6 @@ static VLCMainWindow *_o_sharedInstance = nil;
- (void)drawFancyGradientEffectForTimeSlider
{
if (OSX_LEOPARD)
return;
NSAutoreleasePool * o_pool = [[NSAutoreleasePool alloc] init];
CGFloat f_value = [o_time_sld knobPosition];
if (f_value > 7.5)
......@@ -1964,10 +1943,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( right_window_point > right_screen_point )
new_frame.origin.x -= ( right_window_point - right_screen_point );
if (OSX_LEOPARD)
[o_videoWindow setFrame:new_frame display:YES];
else
[[o_videoWindow animator] setFrame:new_frame display:YES];
[[o_videoWindow animator] setFrame:new_frame display:YES];
}
- (void)setNativeVideoSize:(NSSize)size
......@@ -2095,12 +2071,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
}
if ([screen isMainScreen])
{
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
[[o_video_view superview] replaceSubview:o_video_view with:o_temp_view];
[o_temp_view setFrame:[o_video_view frame]];
......@@ -2155,12 +2126,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
}
if ([screen isMainScreen])
{
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
dict1 = [[NSMutableDictionary alloc] initWithCapacity:2];
dict2 = [[NSMutableDictionary alloc] initWithCapacity:3];
......@@ -2269,10 +2235,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
}
[o_fspanel setNonActive: nil];
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
[NSApp setPresentationOptions: NSApplicationPresentationDefault];
/* Will release the lock */
[self hasEndedFullscreen];
......@@ -2295,10 +2258,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[[o_video_view window] orderFront: self];
[o_fspanel setNonActive: nil];
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
if (o_fullscreen_anim1)
{
......
......@@ -54,10 +54,6 @@ unsigned int CocoaKeyToVLC( unichar i_key );
* the translated string. the translation should be '1:translatedstring' though */
#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
input_thread_t *getInput(void);
......
......@@ -234,12 +234,7 @@ static NSMutableArray *blackoutWindows = NULL;
[blackoutWindow release];
if( [screen isMainScreen] )
{
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeAllHidden, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
[NSApp setPresentationOptions:(NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar)];
}
}
......@@ -253,10 +248,7 @@ static NSMutableArray *blackoutWindows = NULL;
[blackoutWindow closeAndAnimate: YES];
}
if (OSX_LEOPARD)
SetSystemUIMode( kUIModeNormal, kUIOptionAutoShowMenuBar);
else
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
[NSApp setPresentationOptions:(NSApplicationPresentationDefault)];
}
@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