Initial implementation of continuous updates in the server code. This code does not handle framebuffer size changes properly yet. Also, the server does not send the client EndOfContinuousUpdates message yet (documented in doc/rfbproto.tex).
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2251 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index fe60e43..bd067be 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -35,6 +35,7 @@
: SConnection(server_->securityFactory, reverse), sock(s), server(server_),
updates(false), image_getter(server->useEconomicTranslate),
drawRenderedCursor(false), removeRenderedCursor(false),
+ autoUpdatesActive(false),
pointerEventTime(0), accessRights(AccessDefault),
startTime(time(0)), m_pFileTransfer(0)
{
@@ -480,6 +481,35 @@
writeFramebufferUpdate();
}
+void VNCSConnectionST::enableContinuousUpdates(const Rect& r)
+{
+ // TightVNC-specific EnableContinuousUpdates message is very much like
+ // incremental FramebufferUpdateRequest. So here we copy some code from
+ // VNCSConnectionST::framebufferUpdateRequest().
+
+ if (!(accessRights & AccessView)) return;
+
+ SConnection::framebufferUpdateRequest(r, true);
+
+ autoUpdatesActive = true;
+ autoUpdatedRect = r;
+
+ Region reqRgn(autoUpdatedRect);
+ requested.assign_union(reqRgn);
+
+ writeFramebufferUpdate();
+}
+
+void VNCSConnectionST::disableContinuousUpdates()
+{
+ autoUpdatesActive = false;
+ autoUpdatedRect.clear();
+
+ writeFramebufferUpdate();
+
+ // FIXME: Send EndOfContinuousUpdates message.
+}
+
void VNCSConnectionST::setInitialColourMap()
{
setColourMapEntries(0, 0);
@@ -615,6 +645,15 @@
if (drawRenderedCursor)
writeRenderedCursorRect();
writer()->writeFramebufferUpdateEnd();
+ resetRequestedRegion();
+ }
+}
+
+void VNCSConnectionST::resetRequestedRegion()
+{
+ if (autoUpdatesActive) {
+ requested.reset(autoUpdatedRect);
+ } else {
requested.clear();
}
}