mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
macOS - fix some window drawing issues (#3278)
* macOS - fix some window drawing issues fixes an issue with torrent clipping when number of torrents displayed overflows the screen height
This commit is contained in:
parent
bf1d668f9a
commit
955091ce12
3 changed files with 70 additions and 55 deletions
|
@ -1115,7 +1115,7 @@ static void removeKeRangerRansomware()
|
|||
}
|
||||
}
|
||||
|
||||
[self fullUpdateUI];
|
||||
[self drawMainWindow];
|
||||
}
|
||||
|
||||
- (void)askOpenConfirmed:(AddWindowController*)addController add:(BOOL)add
|
||||
|
@ -1135,7 +1135,7 @@ static void removeKeRangerRansomware()
|
|||
}
|
||||
[self.fAddingTransfers addObject:torrent];
|
||||
|
||||
[self fullUpdateUI];
|
||||
[self drawMainWindow];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1209,7 +1209,7 @@ static void removeKeRangerRansomware()
|
|||
[self.fAddingTransfers addObject:torrent];
|
||||
}
|
||||
|
||||
[self fullUpdateUI];
|
||||
[self drawMainWindow];
|
||||
}
|
||||
|
||||
- (void)askOpenMagnetConfirmed:(AddMagnetWindowController*)addController add:(BOOL)add
|
||||
|
@ -1229,7 +1229,7 @@ static void removeKeRangerRansomware()
|
|||
}
|
||||
[self.fAddingTransfers addObject:torrent];
|
||||
|
||||
[self fullUpdateUI];
|
||||
[self drawMainWindow];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1726,6 +1726,8 @@ static void removeKeRangerRansomware()
|
|||
{
|
||||
[torrent closeRemoveTorrent:deleteData];
|
||||
}
|
||||
|
||||
[self drawMainWindow];
|
||||
};
|
||||
|
||||
[self.fTableView beginUpdates];
|
||||
|
@ -1767,9 +1769,9 @@ static void removeKeRangerRansomware()
|
|||
{
|
||||
[torrent closeRemoveTorrent:deleteData];
|
||||
}
|
||||
}
|
||||
|
||||
[self fullUpdateUI];
|
||||
[self drawMainWindow];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeNoDelete:(id)sender
|
||||
|
@ -4991,7 +4993,7 @@ static void removeKeRangerRansomware()
|
|||
}
|
||||
[self.fAddingTransfers addObject:torrent];
|
||||
|
||||
[self fullUpdateUI];
|
||||
[self drawMainWindow];
|
||||
}
|
||||
|
||||
- (void)rpcRemoveTorrent:(Torrent*)torrent deleteData:(BOOL)deleteData
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
@property(nonatomic, readonly) CGFloat titlebarHeight;
|
||||
@property(nonatomic, readonly) CGFloat mainWindowComponentHeight;
|
||||
@property(nonatomic, readonly) CGFloat scrollViewHeight;
|
||||
@property(nonatomic, readonly) CGFloat fullScreenScrollViewHeight;
|
||||
@property(nonatomic, readonly) CGFloat minWindowContentSizeAllowed;
|
||||
@property(nonatomic, readonly) BOOL isFullScreen;
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
- (void)drawMainWindow
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
NSView* contentView = self.fWindow.contentView;
|
||||
NSSize const windowSize = [contentView convertSize:self.fWindow.frame.size fromView:nil];
|
||||
CGFloat originY = NSMaxY(contentView.frame);
|
||||
|
@ -66,6 +67,7 @@
|
|||
//window is updated and animated in fullUpdateUI --> applyFilter --> setWindowSizeToFit
|
||||
[self fullUpdateUI];
|
||||
[self updateForAutoSize];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)setWindowSizeToFit
|
||||
|
@ -131,8 +133,6 @@
|
|||
//update scrollview
|
||||
NSRect scrollViewFrame = scrollView.frame;
|
||||
scrollViewFrame.size.height = scrollViewHeight;
|
||||
scrollViewFrame.origin.y = BOTTOM_BAR_HEIGHT;
|
||||
[scrollView setFrame:scrollViewFrame];
|
||||
|
||||
//we can't call minSize, since it might be set to the current size (auto size)
|
||||
CGFloat const minHeight = self.minWindowContentSizeAllowed +
|
||||
|
@ -145,27 +145,34 @@
|
|||
else
|
||||
{
|
||||
NSScreen* screen = self.fWindow.screen;
|
||||
if (screen)
|
||||
if (screen && !self.isFullScreen)
|
||||
{
|
||||
NSSize maxSize = [scrollView convertSize:screen.visibleFrame.size fromView:nil];
|
||||
maxSize.height += titleBarHeight;
|
||||
maxSize.height += BOTTOM_BAR_HEIGHT;
|
||||
NSSize maxSize = screen.frame.size;
|
||||
maxSize.height -= titleBarHeight;
|
||||
maxSize.height -= BOTTOM_BAR_HEIGHT;
|
||||
|
||||
if (self.fStatusBar)
|
||||
{
|
||||
maxSize.height += STATUS_BAR_HEIGHT;
|
||||
maxSize.height -= STATUS_BAR_HEIGHT;
|
||||
}
|
||||
if (self.fFilterBar)
|
||||
{
|
||||
maxSize.height += FILTER_BAR_HEIGHT;
|
||||
maxSize.height -= FILTER_BAR_HEIGHT;
|
||||
}
|
||||
if (windowSize.height > maxSize.height)
|
||||
{
|
||||
windowSize.height = maxSize.height;
|
||||
|
||||
//recalculate scrollview height
|
||||
scrollViewFrame.size.height = self.fullScreenScrollViewHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//commit scrollview changes
|
||||
scrollViewFrame.origin.y = BOTTOM_BAR_HEIGHT;
|
||||
[scrollView setFrame:scrollViewFrame];
|
||||
|
||||
windowFrame.origin.y -= (windowSize.height - windowFrame.size.height);
|
||||
windowFrame.size.height = windowSize.height;
|
||||
return windowFrame;
|
||||
|
@ -196,7 +203,7 @@
|
|||
{
|
||||
if (self.isFullScreen)
|
||||
{
|
||||
return self.fWindow.frame.size.height - self.titlebarHeight - self.mainWindowComponentHeight - BOTTOM_BAR_HEIGHT;
|
||||
return self.fullScreenScrollViewHeight;
|
||||
}
|
||||
|
||||
if ([self.fDefaults boolForKey:@"AutoSize"])
|
||||
|
@ -214,6 +221,11 @@
|
|||
return NSHeight(self.fTableView.enclosingScrollView.frame);
|
||||
}
|
||||
|
||||
- (CGFloat)fullScreenScrollViewHeight
|
||||
{
|
||||
return self.fWindow.frame.size.height - self.titlebarHeight - self.mainWindowComponentHeight - BOTTOM_BAR_HEIGHT;
|
||||
}
|
||||
|
||||
- (CGFloat)minWindowContentSizeAllowed
|
||||
{
|
||||
CGFloat contentMinHeight = self.fTableView.rowHeight + self.fTableView.intercellSpacing.height +
|
||||
|
|
Loading…
Add table
Reference in a new issue