mirror of
https://github.com/transmission/transmission
synced 2025-02-22 14:10:34 +00:00
Don't use the screen size when there is no screen.
This commit is contained in:
parent
689f35e06a
commit
fb4f10cf38
1 changed files with 39 additions and 25 deletions
|
@ -3250,17 +3250,22 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
const CGFloat minHeight = [self minWindowContentSizeAllowed]
|
||||
+ (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
|
||||
|
||||
if (windowSize.height < minHeight)
|
||||
if (windowSize.height <= minHeight)
|
||||
windowSize.height = minHeight;
|
||||
else
|
||||
{
|
||||
NSSize maxSize = [scrollView convertSize: [[fWindow screen] visibleFrame].size fromView: nil];
|
||||
if (!fStatusBar)
|
||||
maxSize.height -= STATUS_BAR_HEIGHT;
|
||||
if (!fFilterBar)
|
||||
maxSize.height -= FILTER_BAR_HEIGHT;
|
||||
if (windowSize.height > maxSize.height)
|
||||
windowSize.height = maxSize.height;
|
||||
NSScreen * screen = [fWindow screen];
|
||||
if (screen)
|
||||
{
|
||||
NSSize maxSize = [scrollView convertSize: [screen visibleFrame].size fromView: nil];
|
||||
if (!fStatusBar)
|
||||
maxSize.height -= STATUS_BAR_HEIGHT;
|
||||
if (!fFilterBar)
|
||||
maxSize.height -= FILTER_BAR_HEIGHT;
|
||||
if (windowSize.height > maxSize.height)
|
||||
windowSize.height = maxSize.height;
|
||||
NSLog(@"%f %f", windowSize.height, [screen visibleFrame].size.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3301,7 +3306,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[[fStatusBar view] setFrameOrigin: NSMakePoint(0.0, NSMaxY([contentView frame]))];
|
||||
}
|
||||
|
||||
NSRect frame;
|
||||
CGFloat heightChange = [[fStatusBar view] frame].size.height;
|
||||
if (!show)
|
||||
heightChange *= -1;
|
||||
|
@ -3309,14 +3313,19 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
//allow bar to show even if not enough room
|
||||
if (show && ![fDefaults boolForKey: @"AutoSize"])
|
||||
{
|
||||
frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||
CGFloat change = [[fWindow screen] visibleFrame].size.height - frame.size.height;
|
||||
if (change < 0.0)
|
||||
NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||
|
||||
NSScreen * screen = [fWindow screen];
|
||||
if (screen)
|
||||
{
|
||||
frame = [fWindow frame];
|
||||
frame.size.height += change;
|
||||
frame.origin.y -= change;
|
||||
[fWindow setFrame: frame display: NO animate: NO];
|
||||
CGFloat change = [screen visibleFrame].size.height - frame.size.height;
|
||||
if (change < 0.0)
|
||||
{
|
||||
frame = [fWindow frame];
|
||||
frame.size.height += change;
|
||||
frame.origin.y -= change;
|
||||
[fWindow setFrame: frame display: NO animate: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3336,7 +3345,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
const NSUInteger scrollMask = [scrollView autoresizingMask];
|
||||
[scrollView setAutoresizingMask: NSViewNotSizable];
|
||||
|
||||
frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||
NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||
[fWindow setFrame: frame display: YES animate: animate];
|
||||
|
||||
//re-enable autoresize
|
||||
|
@ -3418,13 +3427,18 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
if (show && ![fDefaults boolForKey: @"AutoSize"])
|
||||
{
|
||||
NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||
const CGFloat change = NSHeight([[fWindow screen] visibleFrame]) - NSHeight(frame);
|
||||
if (change < 0.0)
|
||||
|
||||
NSScreen * screen = [fWindow screen];
|
||||
if (screen)
|
||||
{
|
||||
frame = [fWindow frame];
|
||||
frame.size.height += change;
|
||||
frame.origin.y -= change;
|
||||
[fWindow setFrame: frame display: NO animate: NO];
|
||||
CGFloat change = [screen visibleFrame].size.height - frame.size.height;
|
||||
if (change < 0.0)
|
||||
{
|
||||
frame = [fWindow frame];
|
||||
frame.size.height += change;
|
||||
frame.origin.y -= change;
|
||||
[fWindow setFrame: frame display: NO animate: NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4348,8 +4362,8 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
- (NSRect) sizedWindowFrame
|
||||
{
|
||||
NSInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
|
||||
? [fDisplayedTorrents count] : 0;
|
||||
NSUInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
|
||||
? [fDisplayedTorrents count] : 0;
|
||||
|
||||
CGFloat heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
|
||||
+ ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
|
||||
|
|
Loading…
Reference in a new issue