diff options
author | Liang Qi <liang.qi@qt.io> | 2018-06-07 19:10:53 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-06-07 19:10:53 +0200 |
commit | 096e37910d93f9c52976600e985c615ea36fe291 (patch) | |
tree | 713d020f4a04f03d8ca6e111055e7eebe85953a8 /src/plugins/platforms/cocoa | |
parent | 88eda007a3b5046999dd0b287634765efcd8934d (diff) | |
parent | a14a943f9ac3d1e85514d7fb6688c84e624ac850 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
.qmake.conf
src/corelib/kernel/qeventdispatcher_cf.mm
src/gui/kernel/qguiapplication_p.h
src/gui/kernel/qwindowsysteminterface.cpp
src/gui/kernel/qwindowsysteminterface.h
src/plugins/platforms/cocoa/qcocoawindow.mm
src/plugins/platforms/cocoa/qnswindowdelegate.mm
src/plugins/platforms/ios/qioseventdispatcher.mm
src/plugins/platforms/windows/qwindowsdrag.h
src/plugins/platforms/windows/qwindowsinternalmimedata.h
src/plugins/platforms/windows/qwindowsmime.cpp
src/plugins/platforms/winrt/qwinrtscreen.cpp
Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
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 |