cocoa-cb: conditional compilation for Dark Mode and Material features

Fixes #6621
This commit is contained in:
der richter 2019-04-14 15:07:56 +02:00 committed by Jan Ekström
parent 850b303732
commit c540ac8485
4 changed files with 40 additions and 2 deletions

View File

@ -0,0 +1,24 @@
/*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#if !HAVE_MACOS_10_14_FEATURES
let NSAppearanceNameDarkAqua = "NSAppearanceNameDarkAqua"
let NSAppearanceNameAccessibilityHighContrastAqua = "NSAppearanceNameAccessibilityAqua"
let NSAppearanceNameAccessibilityHighContrastDarkAqua = "NSAppearanceNameAccessibilityDarkAqua"
let NSAppearanceNameAccessibilityHighContrastVibrantLight = "NSAppearanceNameAccessibilityVibrantLight"
let NSAppearanceNameAccessibilityHighContrastVibrantDark = "NSAppearanceNameAccessibilityVibrantDark"
#endif

View File

@ -214,6 +214,7 @@ class TitleBar: NSVisualEffectView {
default: break
}
#if HAVE_MACOS_10_11_FEATURES
if #available(macOS 10.11, *) {
switch string {
case "2,", "menu": return .menu
@ -224,7 +225,8 @@ class TitleBar: NSVisualEffectView {
default: break
}
}
#endif
#if HAVE_MACOS_10_14_FEATURES
if #available(macOS 10.14, *) {
switch string {
case "5,", "headerView": return .headerView
@ -239,6 +241,7 @@ class TitleBar: NSVisualEffectView {
default: break
}
}
#endif
return .titlebar
}

12
wscript
View File

@ -945,7 +945,17 @@ standalone_features = [
framework_name=['AppKit'],
compile_filename='test-touchbar.m',
linkflags='-fobjc-arc')
}, {
}, {
'name': '--macos-10-11-features',
'desc': 'macOS 10.11 SDK Features',
'deps': 'cocoa',
'func': check_macos_sdk('10.11')
}, {
'name': '--macos-10-14-features',
'desc': 'macOS 10.14 SDK Features',
'deps': 'cocoa',
'func': check_macos_sdk('10.14')
}, {
'name': '--macos-cocoa-cb',
'desc': 'macOS opengl-cb backend',
'deps': 'cocoa && swift',

View File

@ -165,6 +165,7 @@ def build(ctx):
swift_source = [
( "osdep/macOS_mpv_helper.swift" ),
( "osdep/macOS_swift_extensions.swift" ),
( "osdep/macOS_swift_compat.swift" ),
( "video/out/cocoa-cb/events_view.swift" ),
( "video/out/cocoa-cb/video_layer.swift" ),
( "video/out/cocoa-cb/window.swift" ),