mirror of
https://github.com/debauchee/barrier.git
synced 2024-11-27 18:47:34 +03:00
Pass resolution and center into core on Windows #5030
This commit is contained in:
parent
1ccc258455
commit
66335cd6f8
@ -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;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,9 @@
|
||||
#include "synergy/ClientArgs.h"
|
||||
#include "synergy/ToolArgs.h"
|
||||
#include "synergy/ArgsBase.h"
|
||||
#include "synergy/DpiHelper.h"
|
||||
#include "base/Log.h"
|
||||
#include "base/String.h"
|
||||
|
||||
ArgsBase* ArgParser::m_argsBase = NULL;
|
||||
|
||||
@ -56,6 +58,18 @@ ArgParser::parseServerArgs(ServerArgs& args, int argc, const char* const* argv)
|
||||
// save configuration file path
|
||||
args.m_configFile = argv[++i];
|
||||
}
|
||||
else if (isArg(i, argc, argv, "", "--res-w", 1)) {
|
||||
DpiHelper::s_resolutionWidth = synergy::string::stringToSizeType(argv[++i]);
|
||||
}
|
||||
else if (isArg(i, argc, argv, "", "--res-h", 1)) {
|
||||
DpiHelper::s_resolutionHeight = synergy::string::stringToSizeType(argv[++i]);
|
||||
}
|
||||
else if (isArg(i, argc, argv, "", "--prm-wc", 1)) {
|
||||
DpiHelper::s_primaryWidthCenter = synergy::string::stringToSizeType(argv[++i]);
|
||||
}
|
||||
else if (isArg(i, argc, argv, "", "--prm-hc", 1)) {
|
||||
DpiHelper::s_primaryHeightCenter = synergy::string::stringToSizeType(argv[++i]);
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE, args.m_pname, argv[i], args.m_pname));
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user