From 3c3baf821ed81d449aab9831473365ffc4f2a151 Mon Sep 17 00:00:00 2001 From: David Phillip Oster Date: Sun, 17 Nov 2019 15:17:10 -0800 Subject: [PATCH 1/2] Fix bug where Loupe corners are drawn in gray, not transparent, in macOS 10.15 Catalina --- Progress Bar/TSSTInfoWindow.h | 9 ++++++++- Progress Bar/TSSTInfoWindow.m | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Progress Bar/TSSTInfoWindow.h b/Progress Bar/TSSTInfoWindow.h index 0679b845..e53c9ad7 100644 --- a/Progress Bar/TSSTInfoWindow.h +++ b/Progress Bar/TSSTInfoWindow.h @@ -8,12 +8,19 @@ #import +@interface TSSTOuterInfoView : NSView { + float lastDiameter; +} +- (void)resizeToDiameter:(float)diameter; +@end /* This panel subclass is used by both the loupe and the speach bubble styled page preview. */ -@interface TSSTInfoWindow : NSPanel { } +@interface TSSTInfoWindow : NSPanel { + IBOutlet TSSTOuterInfoView *outerView; +} - (void)caretAtPoint:(NSPoint)point size:(NSSize)size withLimitLeft:(float)left right:(float)right; - (void)centerAtPoint:(NSPoint)center; diff --git a/Progress Bar/TSSTInfoWindow.m b/Progress Bar/TSSTInfoWindow.m index aaaa7605..369a2f30 100644 --- a/Progress Bar/TSSTInfoWindow.m +++ b/Progress Bar/TSSTInfoWindow.m @@ -8,6 +8,7 @@ #import "TSSTInfoWindow.h" #import "TSSTImageUtilities.h" +#import @implementation TSSTInfoWindow @@ -45,6 +46,7 @@ - (void)centerAtPoint:(NSPoint)center { NSRect frame = [self frame]; [self setFrameOrigin: NSMakePoint(center.x - NSWidth(frame) / 2, center.y - NSHeight(frame) / 2)]; + [outerView resizeToDiameter:frame.size.width]; [self invalidateShadow]; } @@ -57,8 +59,32 @@ - (void)resizeToDiameter:(float)diameter [self setFrame: NSMakeRect(center.x - diameter / 2, center.y - diameter / 2, diameter, diameter) display: YES animate: NO]; + [outerView resizeToDiameter:diameter]; } +@end + + +@implementation TSSTOuterInfoView + +- (void)awakeFromNib { + [super awakeFromNib]; + + CALayer *baseLayer = [[CALayer alloc] init]; + baseLayer.backgroundColor = NSColor.clearColor.CGColor; + self.superview.layer = baseLayer; +} + +- (void)resizeToDiameter:(float)diameter { + if (lastDiameter != diameter) { + CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; + CGPathRef path = CGPathCreateWithEllipseInRect(NSMakeRect(0, 0, diameter, diameter), nil); + shapeLayer.path = path; + CGPathRelease(path); + self.superview.layer.mask = shapeLayer; + lastDiameter = diameter; + } +} @end From f042f7953b786f949af803b2cd409b6e9b5033c3 Mon Sep 17 00:00:00 2001 From: David Phillip Oster Date: Sun, 17 Nov 2019 15:17:10 -0800 Subject: [PATCH 2/2] Fix bug where Loupe corners are drawn in gray, not transparent, in macOS 10.15 Catalina --- English.lproj/TSSTSessionWindow.xib | 32 ++++++++++++++++------------- Progress Bar/TSSTInfoWindow.h | 9 +++++++- Progress Bar/TSSTInfoWindow.m | 26 +++++++++++++++++++++++ 3 files changed, 52 insertions(+), 15 deletions(-) diff --git a/English.lproj/TSSTSessionWindow.xib b/English.lproj/TSSTSessionWindow.xib index 3760d662..1d46af2c 100644 --- a/English.lproj/TSSTSessionWindow.xib +++ b/English.lproj/TSSTSessionWindow.xib @@ -1,7 +1,8 @@ - + - + + @@ -25,8 +26,8 @@ - - + + @@ -40,8 +41,8 @@ - - + + @@ -144,7 +145,7 @@ - + @@ -321,13 +322,13 @@ - + - + @@ -338,6 +339,9 @@ + + + @@ -365,7 +369,7 @@ - + @@ -374,7 +378,7 @@ - + @@ -385,7 +389,7 @@ - + @@ -393,7 +397,7 @@ - + @@ -434,7 +438,7 @@ Gw - + diff --git a/Progress Bar/TSSTInfoWindow.h b/Progress Bar/TSSTInfoWindow.h index 0679b845..e53c9ad7 100644 --- a/Progress Bar/TSSTInfoWindow.h +++ b/Progress Bar/TSSTInfoWindow.h @@ -8,12 +8,19 @@ #import +@interface TSSTOuterInfoView : NSView { + float lastDiameter; +} +- (void)resizeToDiameter:(float)diameter; +@end /* This panel subclass is used by both the loupe and the speach bubble styled page preview. */ -@interface TSSTInfoWindow : NSPanel { } +@interface TSSTInfoWindow : NSPanel { + IBOutlet TSSTOuterInfoView *outerView; +} - (void)caretAtPoint:(NSPoint)point size:(NSSize)size withLimitLeft:(float)left right:(float)right; - (void)centerAtPoint:(NSPoint)center; diff --git a/Progress Bar/TSSTInfoWindow.m b/Progress Bar/TSSTInfoWindow.m index aaaa7605..369a2f30 100644 --- a/Progress Bar/TSSTInfoWindow.m +++ b/Progress Bar/TSSTInfoWindow.m @@ -8,6 +8,7 @@ #import "TSSTInfoWindow.h" #import "TSSTImageUtilities.h" +#import @implementation TSSTInfoWindow @@ -45,6 +46,7 @@ - (void)centerAtPoint:(NSPoint)center { NSRect frame = [self frame]; [self setFrameOrigin: NSMakePoint(center.x - NSWidth(frame) / 2, center.y - NSHeight(frame) / 2)]; + [outerView resizeToDiameter:frame.size.width]; [self invalidateShadow]; } @@ -57,8 +59,32 @@ - (void)resizeToDiameter:(float)diameter [self setFrame: NSMakeRect(center.x - diameter / 2, center.y - diameter / 2, diameter, diameter) display: YES animate: NO]; + [outerView resizeToDiameter:diameter]; } +@end + + +@implementation TSSTOuterInfoView + +- (void)awakeFromNib { + [super awakeFromNib]; + + CALayer *baseLayer = [[CALayer alloc] init]; + baseLayer.backgroundColor = NSColor.clearColor.CGColor; + self.superview.layer = baseLayer; +} + +- (void)resizeToDiameter:(float)diameter { + if (lastDiameter != diameter) { + CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init]; + CGPathRef path = CGPathCreateWithEllipseInRect(NSMakeRect(0, 0, diameter, diameter), nil); + shapeLayer.path = path; + CGPathRelease(path); + self.superview.layer.mask = shapeLayer; + lastDiameter = diameter; + } +} @end