Permalink
Browse files

Fix Apple being annoying

  • Loading branch information...
dmoagx committed May 6, 2018
1 parent 0e5c658 commit a54ecfade3696380020d47632b91596ab22b24a5
Showing with 15 additions and 4 deletions.
  1. +15 −4 Source/SPConnectionController.m
@@ -86,6 +86,8 @@
*/
static BOOL FindLinesInFile(NSData *fileData,const void *first,size_t first_len,const void *second,size_t second_len);
static BOOL isOSAtLeast10_7;
@interface SPConnectionController ()
// Privately redeclare as read/write to get the synthesized setter
@@ -178,6 +180,10 @@ @implementation SPConnectionController
@synthesize isConnecting;
@synthesize isEditingConnection;
+ (void)initialize {
isOSAtLeast10_7 = [SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0];
}
- (NSString *)keychainPassword
{
NSString *kcItemName = [self connectionKeychainItemName];
@@ -2981,10 +2987,15 @@ - (void)scrollViewFrameChanged:(NSNotification *)aNotification
// the division may lead to values that are not valid for the current screen size (e.g. non-integer values on a
// @1x non-retina screen). The OS works something out when not using layer-backed views, but in the latter
// case the result will look like garbage if we don't fix this.
// This code is taken from Apple's "BlurryView" example code.
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectToBase:connectionDetailsFrame];
connectionDetailsFrame.origin.y = round(connectionDetailsFrame.origin.y);
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectFromBase:connectionDetailsFrame];
if(isOSAtLeast10_7) {
connectionDetailsFrame = [connectionDetailsScrollView backingAlignedRect:connectionDetailsFrame options:NSAlignAllEdgesNearest];
}
else {
// This code is taken from Apple's "BlurryView" example code.
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectToBase:connectionDetailsFrame];
connectionDetailsFrame.origin.y = round(connectionDetailsFrame.origin.y);
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectFromBase:connectionDetailsFrame];
}
[connectionResizeContainer setFrame:connectionDetailsFrame];
scrollDocumentFrame.size.height = scrollViewFrame.size.height;
[[connectionDetailsScrollView documentView] setFrame:scrollDocumentFrame];

0 comments on commit a54ecfa

Please sign in to comment.