summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qnswindowdelegate.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qnswindowdelegate.mm')
-rw-r--r--src/plugins/platforms/cocoa/qnswindowdelegate.mm17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
index 2d5afa9375..ce74aa9973 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm
@@ -41,6 +41,7 @@
#include "qcocoahelpers.h"
#include <QDebug>
+#include <qpa/qplatformscreen.h>
#include <qpa/qwindowsysteminterface.h>
@implementation QNSWindowDelegate
@@ -62,13 +63,19 @@
return YES;
}
-
-- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
+/*!
+ Overridden to ensure that the zoomed state always results in a maximized
+ window, which would otherwise not be the case for borderless windows.
+*/
+- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)newFrame
{
Q_UNUSED(newFrame);
- if (m_cocoaWindow && !m_cocoaWindow->isForeignWindow())
- [qnsview_cast(m_cocoaWindow->view()) notifyWindowWillZoom:![window isZoomed]];
- return YES;
+
+ // We explicitly go through the QScreen API here instead of just using
+ // window.screen.visibleFrame directly, as that ensures we have the same
+ // behavior for both use-cases/APIs.
+ Q_ASSERT(window == m_cocoaWindow->nativeWindow());
+ return m_cocoaWindow->screen()->availableGeometry().toCGRect();
}
- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu