Clamp window height on macOS
This commit is contained in:
parent
b8f72c7cf2
commit
683662edad
@ -457,8 +457,14 @@
|
|||||||
// Add titlebar height.
|
// Add titlebar height.
|
||||||
height += static_cast<unsigned int>([self titlebarHeight]);
|
height += static_cast<unsigned int>([self titlebarHeight]);
|
||||||
|
|
||||||
// Send resize event if size has changed
|
// Corner case: don't set the window height bigger than the screen height
|
||||||
if (sf::Vector2u(width, height) != m_requester->getSize())
|
// 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 = static_cast<unsigned int>(maxVisibleHeight);
|
||||||
|
|
||||||
|
if (m_requester != nil)
|
||||||
m_requester->windowResized({width, height - static_cast<unsigned int>([self titlebarHeight])});
|
m_requester->windowResized({width, height - static_cast<unsigned int>([self titlebarHeight])});
|
||||||
|
|
||||||
NSRect frame = NSMakeRect([m_window frame].origin.x, [m_window frame].origin.y, width, height);
|
NSRect frame = NSMakeRect([m_window frame].origin.x, [m_window frame].origin.y, width, height);
|
||||||
|
Loading…
Reference in New Issue
Block a user