[vlc-commits] macosx: Make fscontroller compatible with <10.10

Marvin Scholz git at videolan.org
Sun Oct 30 23:35:43 CET 2016


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Tue Oct 11 10:17:30 2016 +0200| [4abb898dab05fb324aa8df0b50a0d79c3adbe024] | committer: Marvin Scholz

macosx: Make fscontroller compatible with <10.10

This will add a fallback mechanism that uses a
normal layer-backed NSView with a dark but still
slightly transparent background on macOS versions
that do not support NSVisualEffectView.

Additionally it will allow compilation with older
SDK's that have no NSVisualEffectView defined.
If compiled with such an SDK, support for
NSVisualEffectView is disabled completely, so
even when running the compiled VLC version
on 10.10 or higher it will use the old fallback
view, as the SDK it was compiled with had not the
necessary definitions.

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

 modules/gui/macosx/CompatibilityFixes.h   |  2 ++
 modules/gui/macosx/VLCFSPanelController.m | 15 +++++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 4a35c1c..0c3e669 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -32,6 +32,8 @@
 #define OSX_EL_CAPITAN (NSAppKitVersionNumber >= 1404 && NSAppKitVersionNumber < 1485)
 #define OSX_SIERRA (NSAppKitVersionNumber >= 1485)
 
+#define OSX_YOSEMITE_OR_HIGHER (NSAppKitVersionNumber >= 1334)
+
 // Sierra only APIs
 #ifndef MAC_OS_X_VERSION_10_12
 
diff --git a/modules/gui/macosx/VLCFSPanelController.m b/modules/gui/macosx/VLCFSPanelController.m
index c74247b..2cb33e5 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -26,6 +26,7 @@
 
 #import "VLCFSPanelController.h"
 #import "VLCCoreInteraction.h"
+#import "CompatibilityFixes.h"
 #import "VLCMain.h"
 
 @interface VLCFSPanelController () {
@@ -58,9 +59,17 @@
     [self.window setStyleMask:self.window.styleMask | NSResizableWindowMask];
     [self.window setBackgroundColor:[NSColor clearColor]];
 
+#ifdef MAC_OS_X_VERSION_10_10
     /* Inject correct background view depending on OS support */
-    [self injectVisualEffectView];
-    //[self injectBackgroundView];
+    if (OSX_YOSEMITE_OR_HIGHER) {
+        [self injectVisualEffectView];
+    } else {
+        [self injectBackgroundView];
+    }
+#else
+    /* Compiled with old SDK, always use legacy style */
+    [self injectBackgroundView];
+#endif
 
     [(NSButtonCell*)[_playPauseButton cell] setHighlightsBy:NSPushInCellMask];
     [(NSButtonCell*)[_playPauseButton cell] setShowsStateBy:NSContentsCellMask];
@@ -321,6 +330,7 @@
 #pragma mark -
 #pragma mark Helpers
 
+#ifdef MAC_OS_X_VERSION_10_10
 /**
  Create an image mask for the NSVisualEffectView
  with rounded corners in the given rect
@@ -371,6 +381,7 @@
     [_controllsView setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
     [self.window.contentView addSubview:_controllsView];
 }
+#endif
 
 /**
  Injects the standard background view in the Windows view hierarchy



More information about the vlc-commits mailing list