From d6caef37cd2d337baac599733a9936b5435240e7 Mon Sep 17 00:00:00 2001 From: Marvin Scholz Date: Wed, 21 Jun 2017 02:09:40 +0200 Subject: [PATCH] macOS: Don't draw custom VLCHUDCheckboxCell on 10.10+ --- modules/gui/macosx/VLCHUDCheckboxCell.m | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/modules/gui/macosx/VLCHUDCheckboxCell.m b/modules/gui/macosx/VLCHUDCheckboxCell.m index 93df527d3a..b9e8c93827 100644 --- a/modules/gui/macosx/VLCHUDCheckboxCell.m +++ b/modules/gui/macosx/VLCHUDCheckboxCell.m @@ -33,9 +33,26 @@ // POSSIBILITY OF SUCH DAMAGE. #import "VLCHUDCheckboxCell.h" +#import "CompatibilityFixes.h" @implementation VLCHUDCheckboxCell ++ (void)load +{ + /* On 10.10+ we do not want custom drawing, therefore we swap out the implementation + * of the selectors below with their original implementations. + * Just calling super will not work, as the AppKit implementation for the NSButton + * checkbox checks if the drawing related selectors below are overriden, and if + * that is the case, will fall back to legacy drawing, without animation, + * without vibrancy and non-layer-based. + */ + if (OSX_YOSEMITE_AND_HIGHER) { + swapoutOverride([VLCHUDCheckboxCell class], @selector(initWithCoder:)); + swapoutOverride([VLCHUDCheckboxCell class], @selector(drawImage:withFrame:inView:)); + swapoutOverride([VLCHUDCheckboxCell class], @selector(drawTitle:withFrame:inView:)); + } +} + - (instancetype)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; -- 2.20.1