Don't use the screen size when there is no screen.
This commit is contained in:
parent
689f35e06a
commit
fb4f10cf38
|
@ -3250,17 +3250,22 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
const CGFloat minHeight = [self minWindowContentSizeAllowed]
|
const CGFloat minHeight = [self minWindowContentSizeAllowed]
|
||||||
+ (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
|
+ (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
|
||||||
|
|
||||||
if (windowSize.height < minHeight)
|
if (windowSize.height <= minHeight)
|
||||||
windowSize.height = minHeight;
|
windowSize.height = minHeight;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NSSize maxSize = [scrollView convertSize: [[fWindow screen] visibleFrame].size fromView: nil];
|
NSScreen * screen = [fWindow screen];
|
||||||
if (!fStatusBar)
|
if (screen)
|
||||||
maxSize.height -= STATUS_BAR_HEIGHT;
|
{
|
||||||
if (!fFilterBar)
|
NSSize maxSize = [scrollView convertSize: [screen visibleFrame].size fromView: nil];
|
||||||
maxSize.height -= FILTER_BAR_HEIGHT;
|
if (!fStatusBar)
|
||||||
if (windowSize.height > maxSize.height)
|
maxSize.height -= STATUS_BAR_HEIGHT;
|
||||||
windowSize.height = maxSize.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]))];
|
[[fStatusBar view] setFrameOrigin: NSMakePoint(0.0, NSMaxY([contentView frame]))];
|
||||||
}
|
}
|
||||||
|
|
||||||
NSRect frame;
|
|
||||||
CGFloat heightChange = [[fStatusBar view] frame].size.height;
|
CGFloat heightChange = [[fStatusBar view] frame].size.height;
|
||||||
if (!show)
|
if (!show)
|
||||||
heightChange *= -1;
|
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
|
//allow bar to show even if not enough room
|
||||||
if (show && ![fDefaults boolForKey: @"AutoSize"])
|
if (show && ![fDefaults boolForKey: @"AutoSize"])
|
||||||
{
|
{
|
||||||
frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||||
CGFloat change = [[fWindow screen] visibleFrame].size.height - frame.size.height;
|
|
||||||
if (change < 0.0)
|
NSScreen * screen = [fWindow screen];
|
||||||
|
if (screen)
|
||||||
{
|
{
|
||||||
frame = [fWindow frame];
|
CGFloat change = [screen visibleFrame].size.height - frame.size.height;
|
||||||
frame.size.height += change;
|
if (change < 0.0)
|
||||||
frame.origin.y -= change;
|
{
|
||||||
[fWindow setFrame: frame display: NO animate: NO];
|
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];
|
const NSUInteger scrollMask = [scrollView autoresizingMask];
|
||||||
[scrollView setAutoresizingMask: NSViewNotSizable];
|
[scrollView setAutoresizingMask: NSViewNotSizable];
|
||||||
|
|
||||||
frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
||||||
[fWindow setFrame: frame display: YES animate: animate];
|
[fWindow setFrame: frame display: YES animate: animate];
|
||||||
|
|
||||||
//re-enable autoresize
|
//re-enable autoresize
|
||||||
|
@ -3418,13 +3427,18 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
||||||
if (show && ![fDefaults boolForKey: @"AutoSize"])
|
if (show && ![fDefaults boolForKey: @"AutoSize"])
|
||||||
{
|
{
|
||||||
NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
|
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];
|
CGFloat change = [screen visibleFrame].size.height - frame.size.height;
|
||||||
frame.size.height += change;
|
if (change < 0.0)
|
||||||
frame.origin.y -= change;
|
{
|
||||||
[fWindow setFrame: frame display: NO animate: NO];
|
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
|
- (NSRect) sizedWindowFrame
|
||||||
{
|
{
|
||||||
NSInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
|
NSUInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
|
||||||
? [fDisplayedTorrents count] : 0;
|
? [fDisplayedTorrents count] : 0;
|
||||||
|
|
||||||
CGFloat heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
|
CGFloat heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
|
||||||
+ ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
|
+ ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
|
||||||
|
|
Loading…
Reference in New Issue