summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/vnc/qvncscreen.cpp
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2016-06-15 15:07:41 +0200
committerAndy Nichols <andy.nichols@qt.io>2016-06-28 10:18:34 +0000
commit2cf3696d9f11ae2aa2dba56a0774bea10d59a482 (patch)
tree79af23327f69f8549a80282ff8f123d152fee066 /src/plugins/platforms/vnc/qvncscreen.cpp
parent2204e9a7c48faf35e41bd338da7efaad78b8efff (diff)
Support multiple connected clients in the VNC plugin
Previously it was only possible for one client to connect at a time. Now it is possible for multiple clients to connect to the VNC server and view and interact with the application. Change-Id: I886583a3abea2955367bf2da490127b041b5c5fb Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/plugins/platforms/vnc/qvncscreen.cpp')
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
index b2ed898dcc..2b38ce6c51 100644
--- a/src/plugins/platforms/vnc/qvncscreen.cpp
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -70,8 +70,6 @@ bool QVncScreen::initialize()
QFbScreen::initializeCompositor();
QT_VNC_DEBUG() << "QVncScreen::init" << geometry();
- disableClientCursor();
-
switch (depth()) {
case 32:
dirty = new QVncDirtyMapOptimized<quint32>(this);
@@ -107,19 +105,23 @@ QRegion QVncScreen::doRedraw()
return touched;
}
-void QVncScreen::enableClientCursor()
+void QVncScreen::enableClientCursor(QVncClient *client)
{
delete mCursor;
- mCursor = 0;
- clientCursor = new QVncClientCursor(vncServer);
+ mCursor = nullptr;
+ if (!clientCursor)
+ clientCursor = new QVncClientCursor();
+ clientCursor->addClient(client);
}
-void QVncScreen::disableClientCursor()
+void QVncScreen::disableClientCursor(QVncClient *client)
{
- if (vncServer && clientCursor) {
+ uint clientCount = clientCursor->removeClient(client);
+ if (clientCount == 0) {
delete clientCursor;
- clientCursor = 0;
+ clientCursor = nullptr;
}
+
mCursor = new QFbCursor(this);
}
@@ -155,5 +157,17 @@ QPixmap QVncScreen::grabWindow(WId wid, int x, int y, int width, int height) con
return QPixmap();
}
+#if Q_BYTE_ORDER == Q_BIG_ENDIAN
+bool QVNCScreen::swapBytes() const
+{
+ if (depth() != 16)
+ return false;
+
+ if (screen())
+ return screen()->frameBufferLittleEndian();
+ return frameBufferLittleEndian();
+}
+#endif
+
QT_END_NAMESPACE