summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/vnc/main.cpp1
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp16
-rw-r--r--src/plugins/platforms/vnc/qvnc_p.h4
-rw-r--r--src/plugins/platforms/vnc/qvncintegration.cpp12
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp17
5 files changed, 34 insertions, 16 deletions
diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp
index b3c78e9caf..1a8c1eeb63 100644
--- a/src/plugins/platforms/vnc/main.cpp
+++ b/src/plugins/platforms/vnc/main.cpp
@@ -54,7 +54,6 @@ public:
QPlatformIntegration* QVncIntegrationPlugin::create(const QString& system, const QStringList& paramList)
{
QT_VNC_DEBUG() << "loading vnc plugin" << system;
- Q_UNUSED(paramList);
if (!system.compare(QLatin1String("vnc"), Qt::CaseInsensitive))
return new QVncIntegration(paramList);
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index c14088c2a1..743888258e 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -611,28 +611,20 @@ uint QVncClientCursor::removeClient(QVncClient *client)
}
#endif
-
-QVncServer::QVncServer(QVncScreen *screen)
- : qvnc_screen(screen)
-{
- QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
-}
-
-QVncServer::QVncServer(QVncScreen *screen, int /*id*/)
+QVncServer::QVncServer(QVncScreen *screen, quint16 port)
: qvnc_screen(screen)
+ , m_port(port)
{
QMetaObject::invokeMethod(this, "init", Qt::QueuedConnection);
}
void QVncServer::init()
{
- const int port = 5900;
-
serverSocket = new QTcpServer(this);
- if (!serverSocket->listen(QHostAddress::Any, port))
+ if (!serverSocket->listen(QHostAddress::Any, m_port))
qDebug() << "QVncServer could not connect:" << serverSocket->errorString();
else
- QT_VNC_DEBUG("QVncServer created on port %d", port);
+ QT_VNC_DEBUG("QVncServer created on port %d", m_port);
QT_VNC_DEBUG() << "running in thread" << thread() << QThread::currentThread();
connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection()));
diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h
index dd8189d30f..cdc49c030a 100644
--- a/src/plugins/platforms/vnc/qvnc_p.h
+++ b/src/plugins/platforms/vnc/qvnc_p.h
@@ -391,8 +391,7 @@ class QVncServer : public QObject
{
Q_OBJECT
public:
- QVncServer(QVncScreen *screen);
- QVncServer(QVncScreen *screen, int id);
+ QVncServer(QVncScreen *screen, quint16 port = 5900);
~QVncServer();
enum ServerMsg { FramebufferUpdate = 0,
@@ -414,6 +413,7 @@ private:
QTcpServer *serverSocket;
QVector<QVncClient*> clients;
QVncScreen *qvnc_screen;
+ quint16 m_port;
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp
index ee224bd36a..810c5d2a90 100644
--- a/src/plugins/platforms/vnc/qvncintegration.cpp
+++ b/src/plugins/platforms/vnc/qvncintegration.cpp
@@ -53,14 +53,24 @@
#include <QtPlatformSupport/private/qlibinputhandler_p.h>
#endif
+#include <QtCore/QRegularExpression>
+
QT_BEGIN_NAMESPACE
QVncIntegration::QVncIntegration(const QStringList &paramList)
: m_fontDb(new QGenericUnixFontDatabase),
m_services(new QGenericUnixServices)
{
+ QRegularExpression portRx(QLatin1String("port=(\\d+)"));
+ quint16 port = 5900;
+ for (const QString &arg : paramList) {
+ QRegularExpressionMatch match;
+ if (arg.contains(portRx, &match))
+ port = match.captured(1).toInt();
+ }
+
m_primaryScreen = new QVncScreen(paramList);
- m_server = new QVncServer(m_primaryScreen);
+ m_server = new QVncServer(m_primaryScreen, port);
m_primaryScreen->vncServer = m_server;
}
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
index 2b38ce6c51..532b9225da 100644
--- a/src/plugins/platforms/vnc/qvncscreen.cpp
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -43,6 +43,7 @@
#include <QtPlatformSupport/private/qfbcursor_p.h>
#include <QtGui/QPainter>
+#include <QtCore/QRegularExpression>
QT_BEGIN_NAMESPACE
@@ -62,11 +63,27 @@ QVncScreen::~QVncScreen()
bool QVncScreen::initialize()
{
+ QRegularExpression sizeRx(QLatin1String("size=(\\d+)x(\\d+)"));
+ QRegularExpression mmSizeRx(QLatin1String("mmsize=(?<width>(\\d*\\.)?\\d+)x(?<height>(\\d*\\.)?\\d+)"));
+ QRegularExpression depthRx(QLatin1String("depth=(\\d+)"));
+
mGeometry = QRect(0, 0, 1024, 768);
mFormat = QImage::Format_ARGB32_Premultiplied;
mDepth = 32;
mPhysicalSize = QSizeF(mGeometry.width()/96.*25.4, mGeometry.height()/96.*25.4);
+ for (const QString &arg : mArgs) {
+ QRegularExpressionMatch match;
+ if (arg.contains(mmSizeRx, &match)) {
+ mPhysicalSize = QSizeF(match.captured("width").toDouble(), match.captured("height").toDouble());
+ } else if (arg.contains(sizeRx, &match)) {
+ mGeometry.setSize(QSize(match.captured(1).toInt(), match.captured(2).toInt()));
+ } else if (arg.contains(depthRx, &match)) {
+ mDepth = match.captured(1).toInt();
+ }
+ }
+
+
QFbScreen::initializeCompositor();
QT_VNC_DEBUG() << "QVncScreen::init" << geometry();