Commit 4abb898d authored by Marvin Scholz's avatar 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.
parent 43b089ca
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment