macOS: Initialize window geometry early on, instead of when creating NSWindow

We don't need to defer to NSWindow creation before determining the initial
window geometry, and we don't need to redetermine each time we re-create
an NSWindow for a QCocoaWindow.

Change-Id: Ie13380830b44e96670ff16513f29deef5f5ae313
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Tor Arne Vestbø 2017-03-27 18:49:10 +02:00
parent 30d825f5f2
commit f368cd8868

View File

@ -491,7 +491,9 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw, WId nativeHandle)
"QT_MAC_WANTS_LAYER");
[m_view setWantsLayer:enable];
}
setGeometry(tlw->geometry());
setGeometry(initialGeometry(window(), windowGeometry(), defaultWindowWidth, defaultWindowHeight));
recreateWindowIfNeeded();
tlw->setGeometry(geometry());
if (tlw->isTopLevel())
@ -1721,7 +1723,7 @@ QCocoaNSWindow *QCocoaWindow::createNSWindow(bool shouldBeChildNSWindow, bool sh
{
QMacAutoReleasePool pool;
QRect rect = initialGeometry(window(), windowGeometry(), defaultWindowWidth, defaultWindowHeight);
QRect rect = geometry();
QScreen *targetScreen = nullptr;
for (QScreen *screen : QGuiApplication::screens()) {