[vlc-commits] macosx/VLCDefaultValueSliderCell: don't access AppKit instance variables directly

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


vlc/vlc-3.0 | branch: master | Felix Paul Kühne <felix at feepk.net> | Sun Jun 10 10:57:12 2018 +0200| [8dcb9bffcae7dccf3f769bc038fcd7bafa5e73fc] | committer: Felix Paul Kühne

macosx/VLCDefaultValueSliderCell: don't access AppKit instance variables directly

Access to those will be removed in a future update of macOS

(cherry picked from commit 934390c913227365f362b294f454791b095f0f60)

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

 modules/gui/macosx/VLCDefaultValueSliderCell.m | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules/gui/macosx/VLCDefaultValueSliderCell.m b/modules/gui/macosx/VLCDefaultValueSliderCell.m
index b46f9d4cbf..4bec1b52b5 100644
--- a/modules/gui/macosx/VLCDefaultValueSliderCell.m
+++ b/modules/gui/macosx/VLCDefaultValueSliderCell.m
@@ -66,7 +66,7 @@
 
 - (void)setDefaultValue:(double)value
 {
-    if (value > _maxValue || value < _minValue)
+    if (value > self.maxValue || value < self.minValue)
         value = DBL_MAX;
 
     if (_defaultValue == DBL_MAX && value != DBL_MAX) {
@@ -127,18 +127,19 @@
 - (NSRect)knobRectFlipped:(BOOL)flipped forValue:(double)doubleValue
  {
      NSRect resultRect;
+     NSRect trackRect = self.trackRect;
      double val = [self normalizedValue:doubleValue] / 100;
 
      if (self.isVertical) {
          resultRect.origin.x = -1;
-         resultRect.origin.y = (NSHeight(_trackRect) - self.knobThickness) * val;
+         resultRect.origin.y = (NSHeight(trackRect) - self.knobThickness) * val;
          if (_isRTL)
-             resultRect.origin.y = (NSHeight(_trackRect) - self.knobThickness) - resultRect.origin.y;
+             resultRect.origin.y = (NSHeight(trackRect) - self.knobThickness) - resultRect.origin.y;
      } else {
-         resultRect.origin.x = (NSWidth(_trackRect) - self.knobThickness) * val;
+         resultRect.origin.x = (NSWidth(trackRect) - self.knobThickness) * val;
          resultRect.origin.y = -1;
          if (_isRTL)
-             resultRect.origin.x = (NSWidth(_trackRect) - self.knobThickness) - resultRect.origin.x;
+             resultRect.origin.x = (NSWidth(trackRect) - self.knobThickness) - resultRect.origin.x;
      }
 
      resultRect.size.height = self.knobThickness;
@@ -227,7 +228,7 @@
     BOOL sliderMovingForward = (oldValue > newValue) ? NO : YES;
 
     // Claculate snap-threshhold
-    double thresh = 100 * (self.knobThickness/3) / _trackRect.size.width;
+    double thresh = 100 * (self.knobThickness/3) / self.trackRect.size.width;
 
     // Snap to default value
     if (_snapsToDefault && ABS(newValue - _normalizedDefaultValue) < thresh) {



More information about the vlc-commits mailing list