diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm index e045d087b..25e8ab13a 100644 --- a/src/SFML/Window/OSX/SFWindowController.mm +++ b/src/SFML/Window/OSX/SFWindowController.mm @@ -391,10 +391,25 @@ [m_window setStyleMask:styleMask ^ NSResizableWindowMask]; // Add titlebar height. + height += [self titlebarHeight]; + + // Corner case: don't set the window height bigger than the screen height + // or the view will be resized _later_ without generating a resize event. + NSRect screenFrame = [[NSScreen mainScreen] visibleFrame]; + CGFloat maxVisibleHeight = screenFrame.size.height; + if (height > maxVisibleHeight) + { + height = maxVisibleHeight; + + // The size is not the requested one, we fire an event + if (m_requester != 0) + m_requester->windowResized(width, height - [self titlebarHeight]); + } + NSRect frame = NSMakeRect([m_window frame].origin.x, [m_window frame].origin.y, width, - height + [self titlebarHeight]); + height); [m_window setFrame:frame display:YES];