From 2cf3696d9f11ae2aa2dba56a0774bea10d59a482 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Wed, 15 Jun 2016 15:07:41 +0200 Subject: 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 --- src/plugins/platforms/vnc/qvncscreen.cpp | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src/plugins/platforms/vnc/qvncscreen.cpp') 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(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 -- cgit v1.2.3