summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/vnc/qvncscreen.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/qvncscreen.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/qvncscreen.cpp')
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
index 29b5dda77d..b2ed898dcc 100644
--- a/src/plugins/platforms/vnc/qvncscreen.cpp
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -40,6 +40,7 @@
#include "qvncscreen.h"
#include "qvnc_p.h"
#include <QtPlatformSupport/private/qfbwindow_p.h>
+#include <QtPlatformSupport/private/qfbcursor_p.h>
#include <QtGui/QPainter>
@@ -55,6 +56,8 @@ QVncScreen::QVncScreen(const QStringList &args)
QVncScreen::~QVncScreen()
{
+ if (clientCursor)
+ delete clientCursor;
}
bool QVncScreen::initialize()
@@ -67,7 +70,7 @@ bool QVncScreen::initialize()
QFbScreen::initializeCompositor();
QT_VNC_DEBUG() << "QVncScreen::init" << geometry();
- mCursor = new QFbCursor(this);
+ disableClientCursor();
switch (depth()) {
case 32:
@@ -104,6 +107,27 @@ QRegion QVncScreen::doRedraw()
return touched;
}
+void QVncScreen::enableClientCursor()
+{
+ delete mCursor;
+ mCursor = 0;
+ clientCursor = new QVncClientCursor(vncServer);
+}
+
+void QVncScreen::disableClientCursor()
+{
+ if (vncServer && clientCursor) {
+ delete clientCursor;
+ clientCursor = 0;
+ }
+ mCursor = new QFbCursor(this);
+}
+
+QPlatformCursor *QVncScreen::cursor() const
+{
+ return mCursor ? static_cast<QPlatformCursor *>(mCursor) : static_cast<QPlatformCursor *>(clientCursor);
+}
+
// grabWindow() grabs "from the screen" not from the backingstores.
// In linuxfb's case it will also include the mouse cursor.
QPixmap QVncScreen::grabWindow(WId wid, int x, int y, int width, int height) const