diff --git a/macosx/InfoActivityViewController.mm b/macosx/InfoActivityViewController.mm index a1791d4b0..b467a4591 100644 --- a/macosx/InfoActivityViewController.mm +++ b/macosx/InfoActivityViewController.mm @@ -99,11 +99,7 @@ static CGFloat const kStackViewVerticalSpacing = 8.0; NSRect viewRect = self.view.frame; CGFloat difference = self.fHeightChange; - if (difference != 0) - { - viewRect.size.height -= difference; - viewRect.size.width = NSWidth(self.view.window.frame); - } + viewRect.size.height -= difference; return viewRect; } @@ -130,32 +126,24 @@ static CGFloat const kStackViewVerticalSpacing = 8.0; { self.oldHeight = self.fCurrentHeight; - [self checkLayout]; - - if (self.fHeightChange != 0) - { - [self updateWindowLayout]; - } + [self updateWindowLayout]; } - (void)updateWindowLayout { - if (self.fCurrentHeight != 0) - { - [self checkLayout]; + [self checkLayout]; - CGFloat difference = self.fHeightChange; + CGFloat difference = self.fHeightChange; - NSRect windowRect = self.view.window.frame; - windowRect.origin.y += difference; - windowRect.size.height -= difference; + NSRect windowRect = self.view.window.frame; + windowRect.origin.y += difference; + windowRect.size.height -= difference; - self.view.window.minSize = NSMakeSize(self.view.window.minSize.width, NSHeight(windowRect)); - self.view.window.maxSize = NSMakeSize(FLT_MAX, NSHeight(windowRect)); + self.view.window.minSize = NSMakeSize(self.view.window.minSize.width, NSHeight(windowRect)); + self.view.window.maxSize = NSMakeSize(FLT_MAX, NSHeight(windowRect)); - self.view.frame = [self viewRect]; - [self.view.window setFrame:windowRect display:YES animate:YES]; - } + self.view.frame = [self viewRect]; + [self.view.window setFrame:windowRect display:YES animate:YES]; } - (void)setInfoForTorrents:(NSArray*)torrents diff --git a/macosx/InfoOptionsViewController.mm b/macosx/InfoOptionsViewController.mm index 763def687..784c06ac9 100644 --- a/macosx/InfoOptionsViewController.mm +++ b/macosx/InfoOptionsViewController.mm @@ -114,10 +114,12 @@ static CGFloat const kStackViewSpacing = 8.0; NSRect viewRect = self.view.frame; CGFloat difference = self.fHeightChange; - if (difference != 0) + + // we check for existence of self.view.window + // as when view is shown from TorrentTableView.mm popover we don't want to customize the view height + if (self.view.window) { viewRect.size.height -= difference; - viewRect.size.width = NSWidth(self.view.window.frame); } return viewRect; @@ -141,17 +143,14 @@ static CGFloat const kStackViewSpacing = 8.0; { self.oldHeight = self.fCurrentHeight; - [self checkLayout]; - - if (self.fHeightChange != 0) - { - [self updateWindowLayout]; - } + [self updateWindowLayout]; } - (void)updateWindowLayout { - if (self.fCurrentHeight != 0) + // we check for existence of self.view.window + // as when view is shown from TorrentTableView.mm popover we don't want to customize the view height + if (self.view.window) { [self checkLayout]; @@ -167,6 +166,13 @@ static CGFloat const kStackViewSpacing = 8.0; self.view.frame = [self viewRect]; [self.view.window setFrame:windowRect display:YES animate:YES]; } + else + { + // set popover width + NSRect rect = self.view.frame; + rect.size.width = NSWidth(self.fOptionsStackView.frame) + (2 * kStackViewInset); + self.view.frame = rect; + } } - (void)setInfoForTorrents:(NSArray*)torrents