diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-01-27 18:30:36 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-01-27 18:38:25 +0100 |
commit | a3322cb171fed42bc3d15adc84d03cf560fc0fc9 (patch) | |
tree | 74edbe0858f1d7ee0e5c65438864286900e5dba9 /video/out/cocoa_common.m | |
parent | fddba2d529c7d37b58a176525f45e5d4fc2c80b4 (diff) | |
download | mpv-a3322cb171fed42bc3d15adc84d03cf560fc0fc9.tar.bz2 mpv-a3322cb171fed42bc3d15adc84d03cf560fc0fc9.tar.xz |
osx_common: cache OSX version number
This commit makes `is_osx_version_at_least` cache the result of reading
`/System/Library/CoreServices/SystemVersion.plist`. Since that is a file
read operation it was bad to use this function frequently (i.e.: when
processing user events).
Remove `is_lion_or_above` (introduced in c9396c0a) as that was a more
specialized wrapper which had the only advantage of adding it's own cache.
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r-- | video/out/cocoa_common.m | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index 217321d593..27f8380112 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -147,20 +147,10 @@ static struct vo_cocoa_state *vo_cocoa_init_state(struct vo *vo) return s; } -static bool is_lion_or_above() -{ - static bool result = false, checked = false; - if (!checked) { - result = is_osx_version_at_least(10, 7, 0); - checked = true; - } - return result; -} - static bool supports_hidpi(NSView *view) { SEL hdpi_selector = @selector(setWantsBestResolutionOpenGLSurface:); - return is_lion_or_above() && view && + return is_osx_version_at_least(10, 7, 0) && view && [view respondsToSelector:hdpi_selector]; } @@ -765,7 +755,8 @@ void create_menu() delta = - [theEvent deltaX]; } - if (is_lion_or_above() && [theEvent hasPreciseScrollingDeltas]) { + if (is_osx_version_at_least(10, 7, 0) && + [theEvent hasPreciseScrollingDeltas]) { s->accumulated_scroll += delta; static const CGFloat threshold = 10; while (s->accumulated_scroll >= threshold) { |