macOS: Minor code style adjustments for VLCHUD classes
[vlc.git] / modules / gui / macosx / VLCHUDCheckboxCell.m
index 7ac23cc..93df527 100644 (file)
@@ -36,7 +36,7 @@
 
 @implementation VLCHUDCheckboxCell
 
-- (instancetype) initWithCoder:(NSCoder *)coder
+- (instancetype)initWithCoder:(NSCoder *)coder
 {
     self = [super initWithCoder:coder];
     if (self) {
@@ -57,7 +57,7 @@
     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;
         [_disabledStrokeColor setStroke];
     }
 
+    [NSGraphicsContext saveGraphicsState];
+    if ([super showsFirstResponder] && [[[self controlView] window] isKeyWindow] &&
+       ([self focusRingType] == NSFocusRingTypeDefault ||
+        [self focusRingType] == NSFocusRingTypeExterior)) {
+        NSSetFocusRingStyle(NSFocusRingOnly);
+    }
     [backgroundPath setLineWidth:1.0];
     [backgroundPath stroke];
+    [NSGraphicsContext restoreGraphicsState];
 
     // Now drawing tick
     if ([self intValue]) {