summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaintegration.mm
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2017-06-02 11:37:53 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2017-07-09 10:02:53 +0000
commit0e0034d93a88d1871bfea813cbe48a4deeafb7dd (patch)
treeeff5d825820205039897ca22b2ede14866c77d7c /src/plugins/platforms/cocoa/qcocoaintegration.mm
parent6be94e8f6d95091944e1a752362eb92e566de390 (diff)
macOS: Simplify QCocoaWindow::handleGeometryChange
There are really only two cases here, where the difference is the coordinate system of the window position. 1) Child QWindow and embedded QWindow: The position is relative to parent view/window origin. 2) Top-level QWindow: The position is relative to screen origin. Change-Id: I867133a5adbbf3a690f574aec06b70c2bc64ad95 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index bac49cfad9..1df74c986a 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -145,7 +145,7 @@ void QCocoaScreen::updateGeometry()
// we may be in the process of creating and registering the primary screen, we
// must special-case that and assign it direcly.
QCocoaScreen *primaryScreen = (nsScreen == [[NSScreen screens] firstObject]) ?
- this : static_cast<QCocoaScreen*>(QGuiApplication::primaryScreen()->handle());
+ this : QCocoaScreen::primaryScreen();
m_geometry = primaryScreen->mapFromNative(m_geometry).toRect();
m_availableGeometry = primaryScreen->mapFromNative(m_availableGeometry).toRect();
@@ -293,6 +293,14 @@ QPixmap QCocoaScreen::grabWindow(WId window, int x, int y, int width, int height
return windowPixmap;
}
+/*!
+ The screen used as a reference for global window geometry
+*/
+QCocoaScreen *QCocoaScreen::primaryScreen()
+{
+ return static_cast<QCocoaScreen *>(QGuiApplication::primaryScreen()->handle());
+}
+
static QCocoaIntegration::Options parseOptions(const QStringList &paramList)
{
QCocoaIntegration::Options options;