mirror of
https://github.com/transmission/transmission
synced 2025-03-12 07:03:44 +00:00
make sure there's a screen before attempting to constrain info window size
This commit is contained in:
parent
25a5834614
commit
01590dacf3
1 changed files with 10 additions and 7 deletions
|
@ -302,14 +302,17 @@ typedef enum
|
|||
|
||||
if ([fViewController respondsToSelector: @selector(saveViewSize)]) //a little bit hacky, but avoids requiring an extra method
|
||||
{
|
||||
const CGFloat screenHeight = NSHeight([[window screen] visibleFrame]);
|
||||
if (NSHeight(windowRect) > screenHeight)
|
||||
if ([window screen])
|
||||
{
|
||||
const CGFloat difference = (screenHeight - NSHeight(windowRect)) * [window userSpaceScaleFactor];
|
||||
windowRect.origin.y -= difference;
|
||||
windowRect.size.height += difference;
|
||||
|
||||
viewRect.size.height += difference;
|
||||
const CGFloat screenHeight = NSHeight([[window screen] visibleFrame]);
|
||||
if (NSHeight(windowRect) > screenHeight)
|
||||
{
|
||||
const CGFloat difference = (screenHeight - NSHeight(windowRect)) * [window userSpaceScaleFactor];
|
||||
windowRect.origin.y -= difference;
|
||||
windowRect.size.height += difference;
|
||||
|
||||
viewRect.size.height += difference;
|
||||
}
|
||||
}
|
||||
|
||||
[window setMinSize: NSMakeSize([window minSize].width, NSHeight(windowRect) - NSHeight(viewRect) + TAB_MIN_HEIGHT)];
|
||||
|
|
Loading…
Add table
Reference in a new issue