Skip to content

Commit a54ecfa

Browse files
committed
Fix Apple being annoying
1 parent 0e5c658 commit a54ecfa

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Source/SPConnectionController.m

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
*/
8787
static BOOL FindLinesInFile(NSData *fileData,const void *first,size_t first_len,const void *second,size_t second_len);
8888

89+
static BOOL isOSAtLeast10_7;
90+
8991
@interface SPConnectionController ()
9092

9193
// Privately redeclare as read/write to get the synthesized setter
@@ -178,6 +180,10 @@ @implementation SPConnectionController
178180
@synthesize isConnecting;
179181
@synthesize isEditingConnection;
180182

183+
+ (void)initialize {
184+
isOSAtLeast10_7 = [SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0];
185+
}
186+
181187
- (NSString *)keychainPassword
182188
{
183189
NSString *kcItemName = [self connectionKeychainItemName];
@@ -2981,10 +2987,15 @@ - (void)scrollViewFrameChanged:(NSNotification *)aNotification
29812987
// the division may lead to values that are not valid for the current screen size (e.g. non-integer values on a
29822988
// @1x non-retina screen). The OS works something out when not using layer-backed views, but in the latter
29832989
// case the result will look like garbage if we don't fix this.
2984-
// This code is taken from Apple's "BlurryView" example code.
2985-
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectToBase:connectionDetailsFrame];
2986-
connectionDetailsFrame.origin.y = round(connectionDetailsFrame.origin.y);
2987-
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectFromBase:connectionDetailsFrame];
2990+
if(isOSAtLeast10_7) {
2991+
connectionDetailsFrame = [connectionDetailsScrollView backingAlignedRect:connectionDetailsFrame options:NSAlignAllEdgesNearest];
2992+
}
2993+
else {
2994+
// This code is taken from Apple's "BlurryView" example code.
2995+
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectToBase:connectionDetailsFrame];
2996+
connectionDetailsFrame.origin.y = round(connectionDetailsFrame.origin.y);
2997+
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectFromBase:connectionDetailsFrame];
2998+
}
29882999
[connectionResizeContainer setFrame:connectionDetailsFrame];
29893000
scrollDocumentFrame.size.height = scrollViewFrame.size.height;
29903001
[[connectionDetailsScrollView documentView] setFrame:scrollDocumentFrame];

0 commit comments

Comments
 (0)