macOS: Do not draw custom VLCHUDTextFieldCell on 10.10+
authorMarvin Scholz <epirat07@gmail.com>
Sat, 17 Jun 2017 00:23:17 +0000 (02:23 +0200)
committerMarvin Scholz <epirat07@gmail.com>
Sat, 17 Jun 2017 00:23:17 +0000 (02:23 +0200)
modules/gui/macosx/VLCHUDTextFieldCell.m

index e5b8bd8..364b54e 100644 (file)
 //                                     provided by [tylerb](GitHub).
 
 #import "VLCHUDTextFieldCell.h"
+#import "CompatibilityFixes.h"
+
+@interface NSTextFieldCell (Private)
+
+- (void)_drawKeyboardFocusRingWithFrame:(NSRect)rect inView:(NSView*)view;
+
+@end
 
 @interface VLCHUDTextFieldCell () {
     bool fillsBackground;
 
 - (void)commonInit
 {
+    if (OSX_YOSEMITE_AND_HIGHER) {
+        return;
+    }
+
     // Init colors
     _focusRing = [[NSShadow alloc] init];
     [_focusRing setShadowColor:NSColor.whiteColor];
 
 - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj
 {
+    if (OSX_YOSEMITE_AND_HIGHER) {
+        return [super setUpFieldEditorAttributes:textObj];
+    }
+
     NSText *newText = [super setUpFieldEditorAttributes:textObj];
     NSColor *textColor = _cellTextColor;
     [(NSTextView *)newText setInsertionPointColor:textColor];
 
 - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
 {
+    if (OSX_YOSEMITE_AND_HIGHER) {
+        return [super drawWithFrame:cellFrame inView:controlView];
+    }
+
     // Adjust Rect
     cellFrame = NSInsetRect(cellFrame, 0.5f, 0.5f);
 
 
 - (void)_drawKeyboardFocusRingWithFrame:(NSRect)rect inView:(NSView*)view
 {
+    if (OSX_YOSEMITE_AND_HIGHER) {
+        if ([super respondsToSelector:@selector(_drawKeyboardFocusRingWithFrame:inView:)]) {
+            [super _drawKeyboardFocusRingWithFrame:rect inView:view];
+        }
+    }
+
     // Do nothing
 }