[vlc-commits] macOS: Don't draw custom VLCHUDCheckboxCell on 10.10+

Marvin Scholz git at videolan.org
Thu Jun 22 23:57:23 CEST 2017


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Jun 21 02:09:40 2017 +0200| [d6caef37cd2d337baac599733a9936b5435240e7] | committer: Marvin Scholz

macOS: Don't draw custom VLCHUDCheckboxCell on 10.10+

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

 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];



More information about the vlc-commits mailing list