[vlc-commits] macosx: retain compatibility with macOS < 10.10

Felix Paul Kühne git at videolan.org
Sun Sep 23 19:45:37 CEST 2018


vlc/vlc-3.0 | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Sep 23 19:41:44 2018 +0200| [002f1025e0388ffd9d057d59b9c37382c3c6d982] | committer: Felix Paul Kühne

macosx: retain compatibility with macOS < 10.10

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

 modules/gui/macosx/CompatibilityFixes.h        |  5 +++++
 modules/gui/macosx/CompatibilityFixes.m        | 14 ++++++++++++++
 modules/gui/macosx/VLCAboutWindowController.m  |  6 +++---
 modules/gui/macosx/VLCAddonsWindowController.m |  3 ++-
 modules/gui/macosx/prefs_widgets.m             |  1 -
 5 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 069aefd8d7..ae842e6fbf 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -58,3 +58,8 @@ typedef NSUInteger NSWindowStyleMask;
 
 void swapoutOverride(Class _Nonnull cls, SEL _Nonnull selector);
 
+ at interface NSColor(VLCAdditions)
+
+ at property(class, strong, readonly) NSColor * _Nonnull VLCSecondaryLabelColor;
+
+ at end
diff --git a/modules/gui/macosx/CompatibilityFixes.m b/modules/gui/macosx/CompatibilityFixes.m
index 6dcbe2cb3d..0418caca5c 100644
--- a/modules/gui/macosx/CompatibilityFixes.m
+++ b/modules/gui/macosx/CompatibilityFixes.m
@@ -43,3 +43,17 @@ void swapoutOverride(Class cls, SEL selector)
     if (subclassMeth && baseImp)
         method_setImplementation(subclassMeth, baseImp);
 }
+
+ at implementation NSColor (VLCAdditions)
+
++ (NSColor *)VLCSecondaryLabelColor
+{
+    SEL secondaryColorSelector = @selector(secondaryLabelColor);
+    if ([super respondsToSelector:secondaryColorSelector]) {
+        return [super performSelector:secondaryColorSelector];
+    } else {
+        return [NSColor colorWithCalibratedWhite:NSDarkGray alpha:1.];
+    }
+}
+
+ at end
diff --git a/modules/gui/macosx/VLCAboutWindowController.m b/modules/gui/macosx/VLCAboutWindowController.m
index d9c10e81e8..a4badff8b5 100644
--- a/modules/gui/macosx/VLCAboutWindowController.m
+++ b/modules/gui/macosx/VLCAboutWindowController.m
@@ -94,7 +94,7 @@
 
     /* l10n */
     [[self window] setTitle: _NS("About VLC media player")];
-    NSDictionary *stringAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName, [NSColor secondaryLabelColor], NSForegroundColorAttributeName, [NSFont systemFontOfSize:13], NSFontAttributeName, nil];
+    NSDictionary *stringAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:NSUnderlineStyleSingle], NSUnderlineStyleAttributeName, [NSColor VLCSecondaryLabelColor], NSForegroundColorAttributeName, [NSFont systemFontOfSize:13], NSFontAttributeName, nil];
     NSAttributedString *attrStr;
     attrStr = [[NSAttributedString alloc] initWithString:_NS("Credits") attributes:stringAttributes];
     [o_credits_btn setAttributedTitle:attrStr];
@@ -141,7 +141,7 @@
     NSMutableAttributedString *joinus_readytorender = [[NSMutableAttributedString alloc] initWithHTML:[joinUsWithStyle dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES]
                                                                                               options:@{NSCharacterEncodingDocumentOption : [NSNumber numberWithInt:NSUTF8StringEncoding]}
                                                                                    documentAttributes:NULL];
-    [joinus_readytorender setAttributes:@{NSForegroundColorAttributeName : [NSColor secondaryLabelColor],
+    [joinus_readytorender setAttributes:@{NSForegroundColorAttributeName : [NSColor VLCSecondaryLabelColor],
                                           NSFontAttributeName : [NSFont systemFontOfSize:12.]}
                                   range:NSMakeRange(0, joinus_readytorender.length)];
     [o_joinus_txt setAllowsEditingTextAttributes: YES];
@@ -199,7 +199,7 @@
         stringToDisplay = toNSStr(psz_license);
 
     NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:stringToDisplay
-                                                                           attributes:@{NSForegroundColorAttributeName : [NSColor secondaryLabelColor],
+                                                                           attributes:@{NSForegroundColorAttributeName : [NSColor VLCSecondaryLabelColor],
                                                                                         NSFontAttributeName : [NSFont systemFontOfSize:12.]}];
     [[o_credits_textview textStorage] setAttributedString:attributedString];
 
diff --git a/modules/gui/macosx/VLCAddonsWindowController.m b/modules/gui/macosx/VLCAddonsWindowController.m
index 37a9a41d9f..ad1280a90d 100644
--- a/modules/gui/macosx/VLCAddonsWindowController.m
+++ b/modules/gui/macosx/VLCAddonsWindowController.m
@@ -26,6 +26,7 @@
 #import "VLCMain.h"
 #import "VLCMainWindow.h"
 #import "VLCAddonListItem.h"
+#import "CompatibilityFixes.h"
 
 @interface VLCAddonsWindowController() <NSTableViewDataSource, NSTableViewDelegate>
 {
@@ -228,7 +229,7 @@ static void addonChangedCallback( addons_manager_t *manager,
     [htmlDescription replaceOccurrencesOfString:@"\n" withString:@"<br />" options:NSLiteralSearch range:NSMakeRange(0, [htmlDescription length])];
     NSMutableAttributedString *attributedDescription = [[NSMutableAttributedString alloc] initWithHTML:[htmlDescription dataUsingEncoding:NSUTF8StringEncoding]
                                                                       documentAttributes:NULL];
-    [attributedDescription setAttributes:@{NSForegroundColorAttributeName : [NSColor secondaryLabelColor], NSFontAttributeName : [NSFont systemFontOfSize:11.]} range:NSMakeRange(0, attributedDescription.length)];
+    [attributedDescription setAttributes:@{NSForegroundColorAttributeName : [NSColor VLCSecondaryLabelColor], NSFontAttributeName : [NSFont systemFontOfSize:11.]} range:NSMakeRange(0, attributedDescription.length)];
     [[_description textStorage] setAttributedString:attributedDescription];
 
     [self updateInstallButton:[currentItem isInstalled]];
diff --git a/modules/gui/macosx/prefs_widgets.m b/modules/gui/macosx/prefs_widgets.m
index b6d088e1ee..a4bd1dbedc 100644
--- a/modules/gui/macosx/prefs_widgets.m
+++ b/modules/gui/macosx/prefs_widgets.m
@@ -2208,7 +2208,6 @@ o_moduleenabled = [NSNumber numberWithBool:NO];\
                       [pb propertyListForType:@"VLC media player module"]) != NULL) {
         NSEnumerator *iter = nil;
         id val;
-        BOOL isCopy = (srcMask & NSDragOperationMove) ? NO:YES;
         // Move the modules
         iter = [array objectEnumerator];
         while ((val = [iter nextObject]) != NULL) {



More information about the vlc-commits mailing list