[vlc-commits] macosx: restore compilation compatibility with SDK versions < 10.14

Felix Paul Kühne git at videolan.org
Mon Sep 24 15:58:44 CEST 2018


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Mon Sep 24 15:58:14 2018 +0200| [e3ea13c07cf5f27e4f714a745d64a625a3f320b1] | committer: Felix Paul Kühne

macosx: restore compilation compatibility with SDK versions < 10.14

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3ea13c07cf5f27e4f714a745d64a625a3f320b1
---

 modules/gui/macosx/CompatibilityFixes.h  | 10 ++++++++++
 modules/gui/macosx/CompatibilityFixes.m  |  6 ++++++
 modules/gui/macosx/VLCBottomBarView.m    |  7 ++-----
 modules/gui/macosx/VLCSlider.m           |  1 +
 modules/gui/macosx/VLCSliderCell.m       |  2 +-
 modules/gui/macosx/VLCVolumeSlider.m     |  2 +-
 modules/gui/macosx/VLCVolumeSliderCell.m |  2 +-
 7 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 20ecf6abba..6b4ca036d4 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -24,5 +24,15 @@
 
 #import <Cocoa/Cocoa.h>
 
+NS_ASSUME_NONNULL_BEGIN
+
 #pragma mark -
 void swapoutOverride(Class _Nonnull cls, SEL _Nonnull selector);
+
+#ifndef MAC_OS_X_VERSION_10_14
+
+extern NSString *const NSAppearanceNameDarkAqua;
+
+#endif
+
+NS_ASSUME_NONNULL_END
diff --git a/modules/gui/macosx/CompatibilityFixes.m b/modules/gui/macosx/CompatibilityFixes.m
index 6dcbe2cb3d..da524d3bc2 100644
--- a/modules/gui/macosx/CompatibilityFixes.m
+++ b/modules/gui/macosx/CompatibilityFixes.m
@@ -43,3 +43,9 @@ void swapoutOverride(Class cls, SEL selector)
     if (subclassMeth && baseImp)
         method_setImplementation(subclassMeth, baseImp);
 }
+
+#ifndef MAC_OS_X_VERSION_10_14
+
+NSString *const NSAppearanceNameDarkAqua = @"NSAppearanceNameDarkAqua";
+
+#endif
diff --git a/modules/gui/macosx/VLCBottomBarView.m b/modules/gui/macosx/VLCBottomBarView.m
index d52ac90e7f..7e6de7eb0e 100644
--- a/modules/gui/macosx/VLCBottomBarView.m
+++ b/modules/gui/macosx/VLCBottomBarView.m
@@ -74,19 +74,16 @@
                                                    endingColor:[NSColor colorWithSRGBRed:0.82 green:0.82 blue:0.82 alpha:1.0]];
     _lightStroke = [NSColor colorWithSRGBRed:0.65 green:0.65 blue:0.65 alpha:1.0];
 
-    if (OSX_MOJAVE_AND_HIGHER) {
+    if (@available(macOS 10.14, *)) {
         _darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.27 green:0.27 blue:0.27 alpha:1.0]
                                                       endingColor:[NSColor colorWithSRGBRed:0.22 green:0.22 blue:0.22 alpha:1.0]];
         _darkStroke = [NSColor colorWithSRGBRed:0.17 green:0.17 blue:0.18 alpha:1.0];
+        [self viewDidChangeEffectiveAppearance];
     } else {
         _darkGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithSRGBRed:0.24 green:0.24 blue:0.24 alpha:1.0]
                                                       endingColor:[NSColor colorWithSRGBRed:0.07 green:0.07 blue:0.07 alpha:1.0]];
         _darkStroke = [NSColor blackColor];
     }
-
-    if (@available(macOS 10.14, *)) {
-        [self viewDidChangeEffectiveAppearance];
-    }
 }
 
 - (void)calculatePaths
diff --git a/modules/gui/macosx/VLCSlider.m b/modules/gui/macosx/VLCSlider.m
index cbe433a659..e6be354861 100644
--- a/modules/gui/macosx/VLCSlider.m
+++ b/modules/gui/macosx/VLCSlider.m
@@ -23,6 +23,7 @@
 
 #import "VLCSlider.h"
 #import "VLCSliderCell.h"
+#import "CompatibilityFixes.h"
 
 @implementation VLCSlider
 
diff --git a/modules/gui/macosx/VLCSliderCell.m b/modules/gui/macosx/VLCSliderCell.m
index e1ed05cc26..561ed32382 100644
--- a/modules/gui/macosx/VLCSliderCell.m
+++ b/modules/gui/macosx/VLCSliderCell.m
@@ -82,7 +82,7 @@
 - (void)setSliderStyleDark
 {
     // Color Declarations
-    if (OSX_MOJAVE_AND_HIGHER) {
+    if (@available(macOS 10.14, *)) {
         _gradientColor = [NSColor colorWithCalibratedRed: 0.20 green: 0.20 blue: 0.20 alpha: 1];
         _knobFillColor = [NSColor colorWithCalibratedRed: 0.81 green: 0.81 blue: 0.81 alpha: 1];
         _activeKnobFillColor = [NSColor colorWithCalibratedRed: 0.76 green: 0.76 blue: 0.76 alpha: 1];
diff --git a/modules/gui/macosx/VLCVolumeSlider.m b/modules/gui/macosx/VLCVolumeSlider.m
index cd5ed92068..3ba95d6bde 100644
--- a/modules/gui/macosx/VLCVolumeSlider.m
+++ b/modules/gui/macosx/VLCVolumeSlider.m
@@ -21,9 +21,9 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
-
 #import "VLCVolumeSlider.h"
 #import "VLCVolumeSliderCell.h"
+#import "CompatibilityFixes.h"
 
 @implementation VLCVolumeSlider
 
diff --git a/modules/gui/macosx/VLCVolumeSliderCell.m b/modules/gui/macosx/VLCVolumeSliderCell.m
index f84ef1e060..722ba85d71 100644
--- a/modules/gui/macosx/VLCVolumeSliderCell.m
+++ b/modules/gui/macosx/VLCVolumeSliderCell.m
@@ -89,7 +89,7 @@
 - (void)setSliderStyleDark
 {
     // Color Declarations
-    if (OSX_MOJAVE_AND_HIGHER) {
+    if (@available(macOS 10.14, *)) {
         _gradientColor = [NSColor colorWithCalibratedRed: 0.20 green: 0.20 blue: 0.20 alpha: 1];
         _knobFillColor = [NSColor colorWithCalibratedRed: 0.81 green: 0.81 blue: 0.81 alpha: 1];
         _activeKnobFillColor = [NSColor colorWithCalibratedRed: 0.76 green: 0.76 blue: 0.76 alpha: 1];



More information about the vlc-commits mailing list