diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 9cb2613d3..2692f988e 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -1160,6 +1160,8 @@ bool MainApplication::restoreStateSlot(QupZilla* window, RestoreData recoveryDat foreach (const RestoreManager::WindowData &data, recoveryData) { QupZilla* window = makeNewWindow(Qz::BW_OtherRestoredWindow); window->restoreWindowState(data); + // for correct geometry calculation in QupZilla::setupUi() + mApp->processEvents(); } destroyRestoreManager(); diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index aaddb0a6b..8bbae066a 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -284,16 +284,16 @@ void QupZilla::setupUi() } else { // Let the WM decides where to put new browser window - if (m_windowType == Qz::BW_NewWindow && mApp->getWindow()) { + if ((m_windowType != Qz::BW_FirstAppWindow && m_windowType != Qz::BW_MacFirstWindow) && mApp->getWindow()) { #ifdef Q_WS_WIN // Windows WM places every new window in the middle of screen .. for some reason QPoint p = mApp->getWindow()->geometry().topLeft(); p.setX(p.x() + 30); p.setY(p.y() + 30); - if (!mApp->desktop()->availableGeometry(this).contains(p)) { - p.setX(mApp->desktop()->availableGeometry(this).x() + 30); - p.setY(mApp->desktop()->availableGeometry(this).y() + 30); + if (!mApp->desktop()->availableGeometry(mApp->getWindow()).contains(p)) { + p.setX(mApp->desktop()->availableGeometry(mApp->getWindow()).x() + 30); + p.setY(mApp->desktop()->availableGeometry(mApp->getWindow()).y() + 30); } setGeometry(QRect(p, mApp->getWindow()->size())); #else @@ -302,8 +302,8 @@ void QupZilla::setupUi() } else if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) { #ifdef Q_WS_WIN - setGeometry(QRect(mApp->desktop()->availableGeometry(this).x() + 30, - mApp->desktop()->availableGeometry(this).y() + 30, 800, 550)); + setGeometry(QRect(mApp->desktop()->availableGeometry(mApp->getWindow()).x() + 30, + mApp->desktop()->availableGeometry(mApp->getWindow()).y() + 30, 800, 550)); #else resize(800, 550); #endif