From 839ad6cf70276c6ee78a2f7adc5555e8fc07a6bb Mon Sep 17 00:00:00 2001
From: Chris Thrasher <chrisjthrasher@gmail.com>
Date: Thu, 27 Apr 2023 16:53:54 -0600
Subject: [PATCH] Emit resize event any time size changes

Fixes bug where resize events only got triggered upon manual window
resizing OR if one called setSize with a height that was too large.
---
 src/SFML/Window/OSX/SFWindowController.mm | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/SFML/Window/OSX/SFWindowController.mm b/src/SFML/Window/OSX/SFWindowController.mm
index 17d67ed5..d09dd80d 100644
--- a/src/SFML/Window/OSX/SFWindowController.mm
+++ b/src/SFML/Window/OSX/SFWindowController.mm
@@ -457,18 +457,9 @@
         // Add titlebar height.
         height += static_cast<unsigned int>([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 = static_cast<unsigned int>(maxVisibleHeight);
-
-            // The size is not the requested one, we fire an event
-            if (m_requester != nil)
-                m_requester->windowResized({width, height - static_cast<unsigned int>([self titlebarHeight])});
-        }
+        // Send resize event if size has changed
+        if (sf::Vector2u(width, height) != m_requester->getSize())
+            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);