: readyForSetColourMapEntries(false),
is(0), os(0), reader_(0), writer_(0),
security(0), securityFactory(secFact), state_(RFBSTATE_UNINITIALISED),
- reverseConnection(reverseConnection_)
+ reverseConnection(reverseConnection_),
+ m_videoSelectionEnabled(false)
{
defaultMajorVersion = 3;
defaultMinorVersion = 8;
os = os_;
}
+void SConnection::setProtocolOptions(bool enableVideoSelection)
+{
+ m_videoSelectionEnabled = enableVideoSelection;
+}
+
void SConnection::initialiseProtocol()
{
cp.writeVersion(os);
ccaps.addTightExt(msgTypeFileDeleteRequest, "FTC_RMRQ");
*/
- // Continuous updates:
ccaps.addTightExt(msgTypeEnableContinuousUpdates, "CUC_ENCU");
+ if (m_videoSelectionEnabled) {
+ ccaps.addTightExt(msgTypeVideoRectangleSelection, "VRECTSEL");
+ }
+
+ //
// Advertise all supported encoding types (except raw encoding).
+ //
+
CapsList ecaps;
// First, add true encodings.
// (i.e. SConnection will not delete them).
void setStreams(rdr::InStream* is, rdr::OutStream* os);
+ // setProtocolOptions() configures TightVNC-specific protocol options.
+ // It can be optionally called before calling initialiseProtocol().
+ // See also: VNCServerST::enableVideoSelection();
+ void setProtocolOptions(bool enableVideoSelection);
+
// initialiseProtocol() should be called once the streams and security
// types are set. Subsequently, processMsg() should be called whenever
// there is data to read on the InStream.
SSecurityFactory* securityFactory;
stateEnum state_;
bool reverseConnection;
+
+ // TightVNC-specific protocol options.
+ bool m_videoSelectionEnabled;
};
}
#endif
}
}
+void SMsgReader::readVideoRectangleSelection()
+{
+ (void)is->readU8();
+ int x = is->readU16();
+ int y = is->readU16();
+ int w = is->readU16();
+ int h = is->readU16();
+ bool enable = w > 0 && h > 0;
+
+ // FIXME: Use proper logger.
+ fprintf(stderr, "Ignoring VideoRectangleSelection message\n");
+
+ // FIXME: Implement VideoRectangleSelection message handling.
+}
+
// Read TightVNC-specific protocol messages.
virtual void readEnableContinuousUpdates();
+ virtual void readVideoRectangleSelection();
SMsgReader(SMsgHandler* handler, rdr::InStream* is);
case msgTypeFileDeleteRequest: handler->processFTMsg(msgType); break;
case msgTypeEnableContinuousUpdates: readEnableContinuousUpdates(); break;
+ case msgTypeVideoRectangleSelection: readVideoRectangleSelection(); break;
default:
fprintf(stderr, "unknown message type %d\n", msgType);
bool VNCSConnectionST::init()
{
try {
+ setProtocolOptions(server->isVideoSelectionEnabled());
initialiseProtocol();
} catch (rdr::Exception& e) {
close(e.str());
securityFactory(sf ? sf : &defaultSecurityFactory),
queryConnectionHandler(0), keyRemapper(&KeyRemapper::defInstance),
useEconomicTranslate(false),
- lastConnectionTime(0), disableclients(false)
+ lastConnectionTime(0), disableclients(false),
+ m_videoSelectionEnabled(false)
{
lastUserInputTime = lastDisconnectTime = time(0);
slog.debug("creating single-threaded server %s", name.buf);
void setFTManager(rfb::SFileTransferManager *pFTManager) { m_pFTManager = pFTManager; };
+ // Enable/disable support for TightVNC-specific VideoRectangleSelection
+ // client message. This is a protocol option that lets a client select a
+ // rectangle to be treated by the server as video data. Once selected, this
+ // part of the framebuffer will be sent using JpegEncoder, on each update
+ // request, as we expect that video data is changing continuously. By
+ // default, this option is disabled, as it's rather a specialized feature
+ // and video selection GUI can confuse users of the TightVNC client.
+ void enableVideoSelection(bool enable) { m_videoSelectionEnabled = enable; }
+ bool isVideoSelectionEnabled() { return m_videoSelectionEnabled; }
+
protected:
friend class VNCSConnectionST;
time_t lastConnectionTime;
bool disableclients;
+
+ bool m_videoSelectionEnabled;
};
};
const int msgTypeFileDeleteRequest = 139;
const int msgTypeEnableContinuousUpdates = 150;
+ const int msgTypeVideoRectangleSelection = 151;
}
#endif
Geometry geo(DisplayWidth(dpy, DefaultScreen(dpy)),
DisplayHeight(dpy, DefaultScreen(dpy)));
XDesktop desktop(dpy, &geo);
+
VNCServerST server("x0vncserver", &desktop);
QueryConnHandler qcHandler(dpy, &server);
server.setQueryConnectionHandler(&qcHandler);
+ server.enableVideoSelection(true);
TcpListener listener((int)rfbport);
vlog.info("Listening on port %d", (int)rfbport);