1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Windows] Fixed issues about window positioning

-Fixed #821 and also position of new window
This commit is contained in:
S. Razi Alavizadeh 2013-03-23 21:07:58 +04:30
parent 1c36390e3f
commit dc659e2fa4
2 changed files with 26 additions and 12 deletions

View File

@ -266,7 +266,7 @@ MainApplication::MainApplication(int &argc, char** argv)
translateApp(); translateApp();
QupZilla* qupzilla = new QupZilla(Qz::BW_FirstAppWindow, startUrl); QupZilla* qupzilla = new QupZilla(Qz::BW_FirstAppWindow, startUrl);
m_mainWindows.append(qupzilla); m_mainWindows.prepend(qupzilla);
connect(qupzilla, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(sendMessages(Qz::AppMessageType,bool))); connect(qupzilla, SIGNAL(message(Qz::AppMessageType,bool)), this, SLOT(sendMessages(Qz::AppMessageType,bool)));
connect(qupzilla, SIGNAL(startingCompleted()), this, SLOT(restoreCursor())); connect(qupzilla, SIGNAL(startingCompleted()), this, SLOT(restoreCursor()));
@ -636,7 +636,7 @@ QupZilla* MainApplication::makeNewWindow(Qz::BrowserWindow type, const QUrl &sta
} }
QupZilla* newWindow = new QupZilla(type, startUrl); QupZilla* newWindow = new QupZilla(type, startUrl);
m_mainWindows.append(newWindow); m_mainWindows.prepend(newWindow);
return newWindow; return newWindow;
} }

View File

@ -84,6 +84,7 @@
#include <QWebFrame> #include <QWebFrame>
#include <QWebHistory> #include <QWebHistory>
#include <QMessageBox> #include <QMessageBox>
#include <QDesktopWidget>
#if QT_VERSION < 0x050000 #if QT_VERSION < 0x050000
#include "qwebkitversion.h" #include "qwebkitversion.h"
@ -266,17 +267,30 @@ void QupZilla::setupUi()
setWindowState(Qt::WindowMaximized); setWindowState(Qt::WindowMaximized);
} }
else { else {
if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) { // Let the WM decides where to put new browser window
setGeometry(QRect(20, 20, 800, 550)); if (m_windowType == Qz::BW_NewWindow && 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);
} }
setGeometry(QRect(p, mApp->getWindow()->size()));
if (m_windowType == Qz::BW_NewWindow) { #else
// Moving window +40 x,y to be visible that this is new window resize(mApp->getWindow()->size());
QPoint p = pos(); #endif
p.setX(p.x() + 40); }
p.setY(p.y() + 40); else if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) {
#ifdef Q_WS_WIN
move(p); setGeometry(QRect(mApp->desktop()->availableGeometry(this).x() + 30,
mApp->desktop()->availableGeometry(this).y() + 30, 800, 550));
#else
resize(800, 550);
#endif
} }
} }