[vlc-commits] macOS: Workaround for VLCDefaultValueSlider misaligned default tickmark
Marvin Scholz
git at videolan.org
Wed Jun 28 18:13:05 CEST 2017
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Wed Jun 28 18:04:03 2017 +0200| [ed2f51bb49f86f34c172a8264c24e309104c4fef] | committer: Marvin Scholz
macOS: Workaround for VLCDefaultValueSlider misaligned default tickmark
Ugly workaround for alignment issues on non-retina displays on macOS
10.10 and higher.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ed2f51bb49f86f34c172a8264c24e309104c4fef
---
modules/gui/macosx/VLCDefaultValueSliderCell.m | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/modules/gui/macosx/VLCDefaultValueSliderCell.m b/modules/gui/macosx/VLCDefaultValueSliderCell.m
index 193bf33889..9ae7723163 100644
--- a/modules/gui/macosx/VLCDefaultValueSliderCell.m
+++ b/modules/gui/macosx/VLCDefaultValueSliderCell.m
@@ -30,6 +30,7 @@
*****************************************************************************/
#import "VLCDefaultValueSliderCell.h"
+#import "CompatibilityFixes.h"
@interface VLCDefaultValueSliderCell (){
BOOL _isRTL;
@@ -175,14 +176,29 @@
tickFrame.size.height = tickThickness;
} else {
CGFloat mid = NSMidX(tickFrame);
- tickFrame.origin.x = mid - tickThickness/2.0;
+ // Ugly workaround
+ // Corrects minor alignment issue on non-retina
+ CGFloat scale = [[[self controlView] window] backingScaleFactor];
+ tickFrame.size.height = cellFrame.size.height;
tickFrame.origin.y = cellFrame.origin.y;
+ if (scale > 1.0) {
+ 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.width = tickThickness;
- tickFrame.size.height = cellFrame.size.height;
}
+ NSAlignmentOptions alignOpts = NSAlignMinXOutward | NSAlignMinYOutward |
+ NSAlignWidthOutward | NSAlignMaxYOutward;
+ NSRect alignedRect = [[self controlView] backingAlignedRect:tickFrame options:alignOpts];
+
// Draw default tick mark
- [self drawDefaultTickMarkWithFrame:tickFrame];
+ [self drawDefaultTickMarkWithFrame:alignedRect];
}
// Redraw knob
More information about the vlc-commits
mailing list