diff options
author | Max <dmoagx@users.noreply.github.com> | 2018-05-06 22:05:33 +0200 |
---|---|---|
committer | Max <dmoagx@users.noreply.github.com> | 2018-05-06 22:05:33 +0200 |
commit | a54ecfade3696380020d47632b91596ab22b24a5 (patch) | |
tree | 482eae4d09a9c91e46cd538f85b87fa8e71bbeb3 | |
parent | 0e5c6589049f9df0fdda70c2e1c0ab6267066412 (diff) | |
download | sequelpro-a54ecfade3696380020d47632b91596ab22b24a5.tar.gz sequelpro-a54ecfade3696380020d47632b91596ab22b24a5.tar.bz2 sequelpro-a54ecfade3696380020d47632b91596ab22b24a5.zip |
Fix Apple being annoying
-rw-r--r-- | Source/SPConnectionController.m | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 8380f827..b9db12ad 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -86,6 +86,8 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; */ 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 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, @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 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, // 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]; |