Pass resolution and center into core on Windows #5030

This commit is contained in:
Jerry (Xinyu Hou)
2015-10-19 11:18:43 -07:00
parent 1ccc258455
commit 66335cd6f8
2 changed files with 33 additions and 0 deletions

View File

@@ -742,6 +742,25 @@ bool MainWindow::serverArgs(QStringList& args, QString& app)
#endif
args << "-c" << configFilename << "--address" << address();
#if defined(Q_OS_WIN)
// pass in physical resolution and primary screen center
// TODO: get this information in the core binary even when
// high DPI is used
int height = QApplication::desktop()->height();
int width = QApplication::desktop()->width();
QRect rec = QApplication::desktop()->screenGeometry();
int heightCenter = rec.height() / 2;
int widthCenter = rec.width() / 2;
appendLogDebug(tr("screen resolution: %1 %2 primary screen center: %3 %4")
.arg(width).arg(height).arg(widthCenter).arg(heightCenter));
args << "--res-w" << QString::number(width);
args << "--res-h" << QString::number(height);
args << "--prm-wc" << QString::number(widthCenter);
args << "--prm-hc" << QString::number(heightCenter);
#endif
return true;
}