macOS: No custom HUD drawing on macOS 10.10+
[vlc.git] / modules / gui / macosx / VLCHUDPopUpButtonCell.m
index b7248cf..b07fd39 100644 (file)
 //     POSSIBILITY OF SUCH DAMAGE.
 
 #import "VLCHUDPopUpButtonCell.h"
+#import "CompatibilityFixes.h"
 
 @implementation VLCHUDPopUpButtonCell
 
++ (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 in the overridden methods is not enough, to get the same drawin
+     * a non-subclassed cell would use.
+     */
+    if (OSX_YOSEMITE_AND_HIGHER) {
+        swapoutOverride([VLCHUDPopUpButtonCell class], @selector(initWithCoder:));
+        swapoutOverride([VLCHUDPopUpButtonCell class], @selector(drawWithFrame:inView:));
+    }
+}
+
 - (instancetype)initWithCoder:(NSCoder *)coder
 {
     self = [super initWithCoder:coder];