[vlc-commits] macosx: remove legacy code for pre-Yosemite macOS versions

Felix Paul Kühne git at videolan.org
Sun Jun 10 13:55:24 CEST 2018


vlc | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Jun 10 13:53:36 2018 +0200| [c38dd543ee965982f1e8fa5dd1dd15b6fc646dce] | committer: Felix Paul Kühne

macosx: remove legacy code for pre-Yosemite macOS versions

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

 modules/gui/macosx/CompatibilityFixes.h            |  1 -
 modules/gui/macosx/Makefile.am                     |  1 -
 modules/gui/macosx/UI/VLCFullScreenPanel.xib       | 26 +++----
 modules/gui/macosx/VLCAboutWindowController.m      |  2 +-
 modules/gui/macosx/VLCDefaultValueSliderCell.m     |  6 +-
 modules/gui/macosx/VLCHelpWindowController.m       |  4 +-
 modules/gui/macosx/VLCTintedImageButtonCell.h      | 30 --------
 modules/gui/macosx/VLCTintedImageButtonCell.m      | 88 ----------------------
 .../gui/macosx/VLCVideoEffectsWindowController.m   | 18 +----
 po/POTFILES.in                                     |  2 -
 10 files changed, 20 insertions(+), 158 deletions(-)

diff --git a/modules/gui/macosx/CompatibilityFixes.h b/modules/gui/macosx/CompatibilityFixes.h
index 5af0d7aaf2..759219fc64 100644
--- a/modules/gui/macosx/CompatibilityFixes.h
+++ b/modules/gui/macosx/CompatibilityFixes.h
@@ -26,7 +26,6 @@
 
 #pragma mark -
 #pragma OS detection code
-#define OSX_YOSEMITE_AND_HIGHER (NSAppKitVersionNumber >= 1334)
 #define OSX_EL_CAPITAN_AND_HIGHER (NSAppKitVersionNumber >= 1404)
 #define OSX_SIERRA_AND_HIGHER (NSAppKitVersionNumber >= 1485)
 #define OSX_SIERRA_DOT_TWO_AND_HIGHER (NSAppKitVersionNumber >= 1504.76) // this is needed to check for MPRemoteCommandCenter
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index e10209ff49..2ce031924a 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -91,7 +91,6 @@ libmacosx_plugin_la_SOURCES = \
 	gui/macosx/VLCDefaultValueSlider.h gui/macosx/VLCDefaultValueSlider.m \
 	gui/macosx/VLCDefaultValueSliderCell.h gui/macosx/VLCDefaultValueSliderCell.m \
 	gui/macosx/VLCImageButton.h gui/macosx/VLCImageButton.m \
-	gui/macosx/VLCTintedImageButtonCell.h gui/macosx/VLCTintedImageButtonCell.m \
 	gui/macosx/VLCTimeField.h gui/macosx/VLCTimeField.m \
 	gui/macosx/VLCHexNumberFormatter.h gui/macosx/VLCHexNumberFormatter.m \
 	gui/macosx/VLCSlider.h gui/macosx/VLCSlider.m \
diff --git a/modules/gui/macosx/UI/VLCFullScreenPanel.xib b/modules/gui/macosx/UI/VLCFullScreenPanel.xib
index f4e3b40d2e..832d56d93b 100644
--- a/modules/gui/macosx/UI/VLCFullScreenPanel.xib
+++ b/modules/gui/macosx/UI/VLCFullScreenPanel.xib
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="16G29" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14269.12" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
-        <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14269.12"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="VLCFSPanelController">
@@ -26,11 +26,11 @@
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <window title="Fullscreen Controls" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hasShadow="NO" hidesOnDeactivate="YES" oneShot="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="a2r-mH-Iqe">
+        <window title="Fullscreen Controls" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hasShadow="NO" hidesOnDeactivate="YES" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="a2r-mH-Iqe">
             <windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES" fullScreenDisallowsTiling="YES"/>
             <windowPositionMask key="initialPositionMask" bottomStrut="YES"/>
             <rect key="contentRect" x="376" y="105" width="480" height="80"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1280" height="778"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1178"/>
             <value key="minSize" type="size" width="480" height="60"/>
             <value key="maxSize" type="size" width="4068" height="150"/>
             <view key="contentView" id="Npt-C5-K77" customClass="VLCFSPanelDraggableView">
@@ -46,7 +46,7 @@
                                     <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="10" id="Ccf-qh-Z4p"/>
                                     <constraint firstAttribute="width" secondItem="iYd-wn-Bnl" secondAttribute="height" multiplier="25:14" id="hNf-AC-5xt"/>
                                 </constraints>
-                                <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCVolumeOnTemplate" imagePosition="only" alignment="center" alternateImage="VLCVolumeOffTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="KZQ-HO-iWj" customClass="VLCTintedImageButtonCell">
+                                <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCVolumeOnTemplate" imagePosition="only" alignment="center" alternateImage="VLCVolumeOffTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="KZQ-HO-iWj">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
@@ -69,7 +69,7 @@
                                         <constraints>
                                             <constraint firstAttribute="width" secondItem="TVM-DT-2yo" secondAttribute="height" multiplier="19:16" id="oKb-iw-6S1"/>
                                         </constraints>
-                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPreviousTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="ykW-vZ-DAm" customClass="VLCTintedImageButtonCell">
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPreviousTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="ykW-vZ-DAm">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
@@ -82,7 +82,7 @@
                                         <constraints>
                                             <constraint firstAttribute="width" secondItem="7QH-jb-QdM" secondAttribute="height" multiplier="19:16" id="isk-o2-kZY"/>
                                         </constraints>
-                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCBackwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="kH8-lS-ZyV" customClass="VLCTintedImageButtonCell">
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCBackwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="kH8-lS-ZyV">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
@@ -95,7 +95,7 @@
                                         <constraints>
                                             <constraint firstAttribute="width" secondItem="YSL-bH-k6U" secondAttribute="height" multiplier="1:1" constant="6" id="2if-S8-t0u"/>
                                         </constraints>
-                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPlayTemplate" imagePosition="overlaps" alignment="center" alternateImage="VLCPauseTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="IvT-4x-6Go" customClass="VLCTintedImageButtonCell">
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCPlayTemplate" imagePosition="overlaps" alignment="center" alternateImage="VLCPauseTemplate" imageScaling="proportionallyUpOrDown" inset="2" id="IvT-4x-6Go">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
@@ -111,7 +111,7 @@
                                         <constraints>
                                             <constraint firstAttribute="width" secondItem="jSN-hV-r5D" secondAttribute="height" multiplier="19:16" id="m1w-9i-bkp"/>
                                         </constraints>
-                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCForwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="i5R-0v-MD5" customClass="VLCTintedImageButtonCell">
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCForwardTemplate" imagePosition="only" alignment="center" continuous="YES" imageScaling="proportionallyUpOrDown" inset="2" id="i5R-0v-MD5">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
@@ -124,7 +124,7 @@
                                         <constraints>
                                             <constraint firstAttribute="width" secondItem="2ai-dB-Wpq" secondAttribute="height" multiplier="19:16" id="Itj-7f-YDa"/>
                                         </constraints>
-                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCNextTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="gqA-yG-zOb" customClass="VLCTintedImageButtonCell">
+                                        <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCNextTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="gqA-yG-zOb">
                                             <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                             <font key="font" metaFont="system"/>
                                         </buttonCell>
@@ -157,7 +157,7 @@
                                 <constraints>
                                     <constraint firstAttribute="width" secondItem="C5K-aX-3aJ" secondAttribute="height" multiplier="1:1" id="VWl-0x-p1I"/>
                                 </constraints>
-                                <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCFullscreenOnTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="0tH-cP-VqB" customClass="VLCTintedImageButtonCell">
+                                <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="VLCFullscreenOnTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="0tH-cP-VqB">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
diff --git a/modules/gui/macosx/VLCAboutWindowController.m b/modules/gui/macosx/VLCAboutWindowController.m
index 183d6145d0..91bc0f1775 100644
--- a/modules/gui/macosx/VLCAboutWindowController.m
+++ b/modules/gui/macosx/VLCAboutWindowController.m
@@ -141,7 +141,7 @@
                                  "\"https://www.videolan.org/contribute/\"><span style=\" text-decoration: "
                                  "underline; color:#0057ae;\">Help and join us!</span></a>"));
 
-    NSString *fontfamily = (OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande";
+    NSString *fontfamily = @"Helvetica Neue";
     NSString *joinUsWithStyle = [NSString stringWithFormat:@"<div style=\"text-align:left;font-family: -apple-system, %@;\">%@</div>",
                                  fontfamily, joinus];
     NSAttributedString *joinus_readytorender = [[NSAttributedString alloc] initWithHTML:[joinUsWithStyle dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES] options:[NSDictionary dictionaryWithObject:[NSNumber numberWithInt:NSUTF8StringEncoding] forKey:NSCharacterEncodingDocumentOption] documentAttributes:NULL];
diff --git a/modules/gui/macosx/VLCDefaultValueSliderCell.m b/modules/gui/macosx/VLCDefaultValueSliderCell.m
index 4bec1b52b5..bef08ce5f9 100644
--- a/modules/gui/macosx/VLCDefaultValueSliderCell.m
+++ b/modules/gui/macosx/VLCDefaultValueSliderCell.m
@@ -182,10 +182,8 @@
                 tickFrame.origin.x = mid;
             } else {
                 tickFrame.origin.x = mid - tickThickness;
-                if (OSX_YOSEMITE_AND_HIGHER) {
-                    tickFrame.size.height = cellFrame.size.height - 1;
-                    tickFrame.origin.y = cellFrame.origin.y - 1;
-                }
+                tickFrame.size.height = cellFrame.size.height - 1;
+                tickFrame.origin.y = cellFrame.origin.y - 1;
             }
             tickFrame.size.width = tickThickness;
         }
diff --git a/modules/gui/macosx/VLCHelpWindowController.m b/modules/gui/macosx/VLCHelpWindowController.m
index ed973de85e..90036fb2f7 100644
--- a/modules/gui/macosx/VLCHelpWindowController.m
+++ b/modules/gui/macosx/VLCHelpWindowController.m
@@ -59,8 +59,8 @@
 - (IBAction)helpGoHome:(id)sender
 {
     NSString *htmlWithStyle = [NSString
-                               stringWithFormat:@"<style>body { font-family: -apple-system, %@; }</style>%@",
-                               ((OSX_YOSEMITE_AND_HIGHER) ? @"Helvetica Neue" : @"Lucida Grande"), _NS(I_LONGHELP)];
+                               stringWithFormat:@"<style>body { font-family: -apple-system, Helvetica Neue; }</style>%@",
+                               _NS(I_LONGHELP)];
 
     [[helpWebView mainFrame] loadHTMLString:htmlWithStyle
                                     baseURL:[NSURL URLWithString:@"http://videolan.org"]];
diff --git a/modules/gui/macosx/VLCTintedImageButtonCell.h b/modules/gui/macosx/VLCTintedImageButtonCell.h
deleted file mode 100644
index 78791f98f4..0000000000
--- a/modules/gui/macosx/VLCTintedImageButtonCell.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * VLCTintedImageButtonCell.h
- *****************************************************************************
- * Copyright (C) 2017 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Marvin Scholz <epirat07 at gmail dot com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
- at interface VLCTintedImageButtonCell : NSButtonCell
-
- at property (nonatomic) IBInspectable NSColor *imageTintColor;
-
- at end
diff --git a/modules/gui/macosx/VLCTintedImageButtonCell.m b/modules/gui/macosx/VLCTintedImageButtonCell.m
deleted file mode 100644
index e440ecc871..0000000000
--- a/modules/gui/macosx/VLCTintedImageButtonCell.m
+++ /dev/null
@@ -1,88 +0,0 @@
-/*****************************************************************************
- * VLCTintedImageButtonCell.m
- *****************************************************************************
- * Copyright (C) 2017 VLC authors and VideoLAN
- * $Id$
- *
- * Authors: Marvin Scholz <epirat07 at gmail dot com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#import "VLCTintedImageButtonCell.h"
-#import "CompatibilityFixes.h"
-
- at interface VLCTintedImageButtonCell () {
-    NSMutableDictionary *_imageCache;
-}
- at end
-
-
- at implementation VLCTintedImageButtonCell
-
-+ (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 is not enough here, as the button would still draw in a different
-     * way, non vibrant with weird highlighting behaviour.
-     */
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        swapoutOverride([VLCTintedImageButtonCell class], @selector(initWithCoder:));
-        swapoutOverride([VLCTintedImageButtonCell class], @selector(drawImage:withFrame:inView:));
-    }
-}
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
-    self = [super initWithCoder:coder];
-    if (self) {
-        _imageCache = [NSMutableDictionary dictionary];
-        _imageTintColor = [NSColor whiteColor];
-    }
-    return self;
-}
-
-- (NSImage *)image:(NSImage*)image tintedWithColor:(NSColor *)tint
-{
-    image = [image copy];
-    [image setTemplate:NO];
-    if (tint) {
-        [image lockFocus];
-        NSRect imageRect = {NSZeroPoint, [image size]};
-        [tint setFill];
-        NSRectFillUsingOperation(imageRect, NSCompositeSourceAtop);
-        [image unlockFocus];
-    }
-    return image;
-}
-
-- (NSImage*)tintedImage:(NSImage*)image
-{
-    NSNumber *key = @((NSInteger)image);
-    if (![_imageCache objectForKey:key]) {
-        NSImage *tintedImg = [self image:image tintedWithColor:_imageTintColor];
-        [_imageCache setObject:tintedImg forKey:key];
-    }
-    return [_imageCache objectForKey:key];
-}
-
-- (void)drawImage:(NSImage *)image withFrame:(NSRect)frame inView:(NSView *)controlView
-{
-    image = [self tintedImage:image];
-    [super drawImage:image withFrame:frame inView:controlView];
-}
-
- at end
diff --git a/modules/gui/macosx/VLCVideoEffectsWindowController.m b/modules/gui/macosx/VLCVideoEffectsWindowController.m
index bb1df42687..9a92d5c6d3 100644
--- a/modules/gui/macosx/VLCVideoEffectsWindowController.m
+++ b/modules/gui/macosx/VLCVideoEffectsWindowController.m
@@ -775,14 +775,7 @@
 - (void)addProfile:(id)sender
 {
     /* show panel */
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
-#ifdef MAC_OS_X_VERSION_10_10
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        [[_textfieldPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
-    }
-#endif
-#pragma clang diagnostic pop
+    [[_textfieldPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
     [_textfieldPanel setTitleString:_NS("Duplicate current profile for a new profile")];
     [_textfieldPanel setSubTitleString:_NS("Enter a name for the new profile:")];
     [_textfieldPanel setCancelButtonString:_NS("Cancel")];
@@ -840,14 +833,7 @@
 - (void)removeProfile:(id)sender
 {
     /* show panel */
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpartial-availability"
-#ifdef MAC_OS_X_VERSION_10_10
-    if (OSX_YOSEMITE_AND_HIGHER) {
-        [[_popupPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
-    }
-#endif
-#pragma clang diagnostic pop
+    [[_popupPanel window] setAppearance:[NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]];
     [_popupPanel setTitleString:_NS("Remove a preset")];
     [_popupPanel setSubTitleString:_NS("Select the preset you would like to remove:")];
     [_popupPanel setOkButtonString:_NS("Remove")];
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d8537d7e7b..7683c437eb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -544,8 +544,6 @@ modules/gui/macosx/VLCTimeField.h
 modules/gui/macosx/VLCTimeField.m
 modules/gui/macosx/VLCTimeSelectionPanelController.h
 modules/gui/macosx/VLCTimeSelectionPanelController.m
-modules/gui/macosx/VLCTintedImageButtonCell.h
-modules/gui/macosx/VLCTintedImageButtonCell.m
 modules/gui/macosx/VLCTrackSynchronizationWindowController.h
 modules/gui/macosx/VLCTrackSynchronizationWindowController.m
 modules/gui/macosx/VLCUIWidgets.h



More information about the vlc-commits mailing list