diff options
Diffstat (limited to 'src/plugins/platforms/cocoa')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoadrag.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindowdelegate.mm | 24 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h index dc0cc17dfb..5a5b985c6e 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.h +++ b/src/plugins/platforms/cocoa/qcocoadrag.h @@ -46,6 +46,7 @@ #include <private/qsimpledrag_p.h> #include <QtGui/private/qdnd_p.h> +#include <QtGui/private/qinternalmimedata_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index be85debdbc..022242130b 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -567,7 +567,7 @@ void QCocoaWindow::setWindowFlags(Qt::WindowFlags flags) Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); if ((type & Qt::Popup) != Qt::Popup && (type & Qt::Dialog) != Qt::Dialog) { NSWindowCollectionBehavior behavior = m_view.window.collectionBehavior; - if (flags & Qt::WindowFullscreenButtonHint) { + if ((flags & Qt::WindowFullscreenButtonHint) || m_view.window.qt_fullScreen) { behavior |= NSWindowCollectionBehaviorFullScreenPrimary; behavior &= ~NSWindowCollectionBehaviorFullScreenAuxiliary; } else { diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 1888dc1c90..6079a35d05 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -40,6 +40,7 @@ #include "qnswindowdelegate.h" #include "qcocoahelpers.h" #include "qcocoawindow.h" +#include "qcocoascreen.h" #include <QDebug> #include <QtCore/private/qcore_mac_p.h> @@ -72,15 +73,24 @@ static QRegExp whitespaceRegex = QRegExp(QStringLiteral("\\s*")); 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 +- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)proposedFrame { - Q_UNUSED(newFrame); - - // 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_UNUSED(proposedFrame); Q_ASSERT(window == m_cocoaWindow->nativeWindow()); - return NSRectFromCGRect(m_cocoaWindow->screen()->availableGeometry().toCGRect()); + + // We compute the maximized state based on the maximum size, and + // the current position of the window. This may result in the window + // geometry falling outside of the current screen's available geometry, + // e.g. when there is not maximize size set, but this is okey, AppKit + // will then shift and possibly clip the geometry for us. + const QWindow *w = m_cocoaWindow->window(); + QRect maximizedRect = QRect(w->framePosition(), w->maximumSize()); + + // QWindow::maximumSize() refers to the client size, + // but AppKit expects the full frame size. + maximizedRect.adjust(0, 0, 0, w->frameMargins().top()); + + return QCocoaScreen::mapToNative(maximizedRect); } - (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu |