// POSSIBILITY OF SUCH DAMAGE.
#import "VLCHUDCheckboxCell.h"
+#import "CompatibilityFixes.h"
@implementation VLCHUDCheckboxCell
-- (instancetype) initWithCoder:(NSCoder *)coder
++ (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];
if (self) {
return self;
}
-- (void) drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
+- (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
{
// Set frame size correctly
NSRect backgroundFrame = frame;