Skip to content

Commit

Permalink
Fix Apple being annoying
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoagx committed May 6, 2018
1 parent 0e5c658 commit a54ecfa
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions Source/SPConnectionController.m
Expand Up @@ -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 FindLinesInFile(NSData *fileData,const void *first,size_t first_len,const void *second,size_t second_len);


static BOOL isOSAtLeast10_7;

@interface SPConnectionController () @interface SPConnectionController ()


// Privately redeclare as read/write to get the synthesized setter // Privately redeclare as read/write to get the synthesized setter
Expand Down Expand Up @@ -178,6 +180,10 @@ @implementation SPConnectionController
@synthesize isConnecting; @synthesize isConnecting;
@synthesize isEditingConnection; @synthesize isEditingConnection;


+ (void)initialize {
isOSAtLeast10_7 = [SPOSInfo isOSVersionAtLeastMajor:10 minor:7 patch:0];
}

- (NSString *)keychainPassword - (NSString *)keychainPassword
{ {
NSString *kcItemName = [self connectionKeychainItemName]; NSString *kcItemName = [self connectionKeychainItemName];
Expand Down Expand Up @@ -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 // 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 // @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. // case the result will look like garbage if we don't fix this.
// This code is taken from Apple's "BlurryView" example code. if(isOSAtLeast10_7) {
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectToBase:connectionDetailsFrame]; connectionDetailsFrame = [connectionDetailsScrollView backingAlignedRect:connectionDetailsFrame options:NSAlignAllEdgesNearest];
connectionDetailsFrame.origin.y = round(connectionDetailsFrame.origin.y); }
connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectFromBase:connectionDetailsFrame]; 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]; [connectionResizeContainer setFrame:connectionDetailsFrame];
scrollDocumentFrame.size.height = scrollViewFrame.size.height; scrollDocumentFrame.size.height = scrollViewFrame.size.height;
[[connectionDetailsScrollView documentView] setFrame:scrollDocumentFrame]; [[connectionDetailsScrollView documentView] setFrame:scrollDocumentFrame];
Expand Down

0 comments on commit a54ecfa

Please sign in to comment.