summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-28 16:53:17 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-30 22:57:35 +0200
commitae1fa639e01fdfe234d9106dd7dd093012fffe6c (patch)
treeddcd99768792d6de86a4fc7dfddda28df334c5ce /video
parentf7ad81c0f5905637c16480b2e44dd41f2839293a (diff)
downloadmpv-ae1fa639e01fdfe234d9106dd7dd093012fffe6c.tar.bz2
mpv-ae1fa639e01fdfe234d9106dd7dd093012fffe6c.tar.xz
osx: remove compatibility conditionals for 10.6
At this point 10.6 is pretty old and we don't want to supporting old platforms. I'm killing all the 10.6 compatibility code before doing more refactorings. Next commits will also use newer Objective-C syntax such as literals and @autoreleasepool.
Diffstat (limited to 'video')
-rw-r--r--video/out/cocoa_common.m74
-rw-r--r--video/out/osx_common.h1
-rw-r--r--video/out/osx_common.m44
3 files changed, 13 insertions, 106 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m
index 29f6eee026..4560dafe50 100644
--- a/video/out/cocoa_common.m
+++ b/video/out/cocoa_common.m
@@ -41,18 +41,6 @@
#include "osdep/macosx_application.h"
-#ifndef NSOpenGLPFAOpenGLProfile
-#define NSOpenGLPFAOpenGLProfile 99
-#endif
-
-#ifndef NSOpenGLProfileVersionLegacy
-#define NSOpenGLProfileVersionLegacy 0x1000
-#endif
-
-#ifndef NSOpenGLProfileVersion3_2Core
-#define NSOpenGLProfileVersion3_2Core 0x3200
-#endif
-
#define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask)
#define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask)
@@ -68,23 +56,6 @@ static bool RightAltPressed(NSEvent *event)
NSRightAlternateKeyMask;
}
-// add methods not available on OSX versions prior to 10.7
-#ifndef MAC_OS_X_VERSION_10_7
-@interface NSView (IntroducedInLion)
-- (NSRect)convertRectToBacking:(NSRect)aRect;
-- (void)setWantsBestResolutionOpenGLSurface:(BOOL)aBool;
-@end
-@interface NSEvent (IntroducedInLion)
-- (BOOL)hasPreciseScrollingDeltas;
-@end
-#endif
-
-// add power management assertion not available on OSX versions prior to 10.7
-#ifndef kIOPMAssertionTypePreventUserIdleDisplaySleep
-#define kIOPMAssertionTypePreventUserIdleDisplaySleep \
- CFSTR("PreventUserIdleDisplaySleep")
-#endif
-
@interface GLMPlayerWindow : NSWindow <NSWindowDelegate>
- (BOOL)canBecomeKeyWindow;
- (BOOL)canBecomeMainWindow;
@@ -208,23 +179,11 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo)
return s;
}
-static bool supports_hidpi(NSView *view)
-{
- SEL hdpi_selector = @selector(setWantsBestResolutionOpenGLSurface:);
- return is_osx_version_at_least(10, 7, 0) && view &&
- [view respondsToSelector:hdpi_selector];
-}
-
static NSRect to_pixels(struct vo *vo, NSRect frame)
{
struct vo_cocoa_state *s = vo->cocoa;
NSView *view = [s->window contentView];
-
- if (supports_hidpi(view)) {
- return [view convertRectToBacking: frame];
- } else {
- return frame;
- }
+ return [view convertRectToBacking: frame];
}
void *vo_cocoa_glgetaddr(const char *s)
@@ -252,13 +211,11 @@ static void disable_power_management(struct vo *vo)
{
struct vo_cocoa_state *s = vo->cocoa;
if (s->power_mgmt_assertion) return;
-
- CFStringRef assertion_type = kIOPMAssertionTypeNoDisplaySleep;
- if (is_osx_version_at_least(10, 7, 0))
- assertion_type = kIOPMAssertionTypePreventUserIdleDisplaySleep;
-
- IOPMAssertionCreateWithName(assertion_type, kIOPMAssertionLevelOn,
- CFSTR("io.mpv.power_management"), &s->power_mgmt_assertion);
+ IOPMAssertionCreateWithName(
+ kIOPMAssertionTypePreventUserIdleDisplaySleep,
+ kIOPMAssertionLevelOn,
+ CFSTR("io.mpv.power_management"),
+ &s->power_mgmt_assertion);
}
int vo_cocoa_init(struct vo *vo)
@@ -422,19 +379,15 @@ static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height,
GLMPlayerOpenGLView *glView =
[[GLMPlayerOpenGLView alloc] initWithFrame:glview_rect];
- // check for HiDPI support and enable it (available on 10.7 +)
- if (supports_hidpi(glView))
- [glView setWantsBestResolutionOpenGLSurface:YES];
+ [glView setWantsBestResolutionOpenGLSurface:YES];
int i = 0;
NSOpenGLPixelFormatAttribute attr[32];
- if (is_osx_version_at_least(10, 7, 0)) {
- attr[i++] = NSOpenGLPFAOpenGLProfile;
- if (gl3profile) {
- attr[i++] = NSOpenGLProfileVersion3_2Core;
- } else {
- attr[i++] = NSOpenGLProfileVersionLegacy;
- }
+ attr[i++] = NSOpenGLPFAOpenGLProfile;
+ if (gl3profile) {
+ attr[i++] = NSOpenGLProfileVersion3_2Core;
+ } else {
+ attr[i++] = NSOpenGLProfileVersionLegacy;
}
attr[i++] = NSOpenGLPFADoubleBuffer; // double buffered
attr[i] = (NSOpenGLPixelFormatAttribute)0;
@@ -874,8 +827,7 @@ int vo_cocoa_cgl_color_size(struct vo *vo)
delta = - [theEvent deltaX];
}
- if (is_osx_version_at_least(10, 7, 0) &&
- [theEvent hasPreciseScrollingDeltas]) {
+ if ([theEvent hasPreciseScrollingDeltas]) {
s->accumulated_scroll += delta;
static const CGFloat threshold = 10;
while (s->accumulated_scroll >= threshold) {
diff --git a/video/out/osx_common.h b/video/out/osx_common.h
index 8d2d70edc4..32bba12d21 100644
--- a/video/out/osx_common.h
+++ b/video/out/osx_common.h
@@ -22,7 +22,6 @@
struct vo;
int convert_key(unsigned key, unsigned charcode);
-int is_osx_version_at_least(int majorv, int minorv, int bugfixv);
NSString *escape_loadfile_name(NSString *input);
#endif /* MPLAYER_OSX_COMMON_H */
diff --git a/video/out/osx_common.m b/video/out/osx_common.m
index 93281ecb6e..5b5e4fbd8f 100644
--- a/video/out/osx_common.m
+++ b/video/out/osx_common.m
@@ -115,50 +115,6 @@ int convert_key(unsigned key, unsigned charcode)
return charcode;
}
-/**
- * Checks at runtime that OSX version is the same or newer than the one
- * provided as input.
- * Currently reads SystemVersion.plist file since Gestalt was deprecated.
- * This is supposedly the current way supported by Apple engineers. More info:
- * http://stackoverflow.com/a/11072974/499456
- */
-int is_osx_version_at_least(int majorv, int minorv, int bugfixv)
-{
- // Initialize cache
- static int c_majorv = -1, c_minorv = -1, c_bugfixv = -1;
-
- // If version cache is empty, fill it
- if (c_majorv < 0 && c_minorv < 0 && c_bugfixv < 0) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSString *plist = @"/System/Library/CoreServices/SystemVersion.plist";
- NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:plist];
- NSString *version = [dict objectForKey:@"ProductVersion"];
- NSArray *components = [version componentsSeparatedByString:@"."];
-
- // All the above code just sends messages to nil. If anything failed,
- // we just end up with an invalid components array.
- if ([components count] != 3) {
- mp_msg(MSGT_VO, MSGL_ERR, "[osx] Failed to get your system version. "
- "Please open a bug report.\n");
- [pool release];
- return -1;
- }
-
- c_majorv = [[components objectAtIndex:0] intValue];
- c_minorv = [[components objectAtIndex:1] intValue];
- c_bugfixv = [[components objectAtIndex:2] intValue];
-
- [pool release];
- }
-
- if(c_majorv > majorv ||
- (c_majorv == majorv && (c_minorv > minorv ||
- (c_minorv == minorv && c_bugfixv >= bugfixv))))
- return 1;
- else
- return 0;
-}
-
struct escape_couple {
NSString *in;
NSString *out;