summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/vnc/qvnc.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-12-17 13:29:34 +0100
committerAndy Nichols <andy.nichols@qt.io>2016-06-28 10:18:27 +0000
commit1f1b773a35a1403af02c5f5a359933bfc459457d (patch)
treef3b4f79213da529ce9898e3dd3ffd6de53427b05 /src/plugins/platforms/vnc/qvnc.cpp
parentef4db5a347c6ad1ddb75027c8449ade64b731d08 (diff)
Support for client side cursors in the VNC plugin
Client side cursors are a major performance optimization, avoiding the need to transmit images to the client just because the cursor has moved. Change-Id: Icdf4ff948571d39d82c86d251bca46390889d02f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'src/plugins/platforms/vnc/qvnc.cpp')
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp27
1 files changed, 7 insertions, 20 deletions
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index da03d889a6..6b9c55e4db 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -526,6 +526,9 @@ void QRfbRawEncoder::write()
QVncClientCursor::QVncClientCursor(QVncServer *s)
: server(s)
{
+ QWindow *w = QGuiApplication::focusWindow();
+ QCursor c = w ? w->cursor() : QCursor(Qt::ArrowCursor);
+ changeCursor(&c, 0);
}
QVncClientCursor::~QVncClientCursor()
@@ -634,9 +637,6 @@ void QVncServer::init()
connect(serverSocket, SIGNAL(newConnection()), this, SLOT(newConnection()));
-#ifndef QT_NO_QWS_CURSOR
- qvnc_cursor = 0;
-#endif
encoder = 0;
}
@@ -646,10 +646,6 @@ QVncServer::~QVncServer()
encoder = 0;
delete client;
client = 0;
-#ifndef QT_NO_QWS_CURSOR
- delete qvnc_cursor;
- qvnc_cursor = 0;
-#endif
}
void QVncServer::setDirty()
@@ -977,10 +973,8 @@ void QVncServer::setEncodings()
break;
case Cursor:
supportCursor = true;
- if (!qvnc_screen->screen()) {
- delete qvnc_cursor;
- qvnc_cursor = new QVncClientCursor(this);
- }
+ qDebug() << "client side cursor supported.";
+ qvnc_screen->enableClientCursor();
break;
case DesktopSize:
supportDesktopSize = true;
@@ -1259,10 +1253,7 @@ void QVncServer::checkUpdate()
return;
if (dirtyCursor) {
-#ifndef QT_NO_QWS_CURSOR
- Q_ASSERT(qvnc_cursor);
- qvnc_cursor->write();
-#endif
+ qvnc_screen->clientCursor->write();
dirtyCursor = false;
wantUpdate = false;
return;
@@ -1287,11 +1278,7 @@ void QVncServer::discardClient()
state = Disconnected;
delete encoder;
encoder = 0;
-#ifndef QT_NO_QWS_CURSOR
- delete qvnc_cursor;
- qvnc_cursor = 0;
-#endif
-
+ qvnc_screen->disableClientCursor();
qvnc_screen->setPowerState(QPlatformScreen::PowerStateOff);
}