Browse Source

Support for VideoRectangleSelection client message in the server code. The message is read but ignored (only a message will be written to stderr).


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2559 3789f03b-4d11-0410-bbf8-ca57d06f2519
tags/v0.0.90
Constantin Kaplinsky 16 years ago
parent
commit
8232831bb4

+ 14
- 2
common/rfb/SConnection.cxx View File

@@ -46,7 +46,8 @@ SConnection::SConnection(SSecurityFactory* secFact, bool reverseConnection_)
: 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;
@@ -76,6 +77,11 @@ void SConnection::setStreams(rdr::InStream* is_, rdr::OutStream* os_)
os = os_;
}

void SConnection::setProtocolOptions(bool enableVideoSelection)
{
m_videoSelectionEnabled = enableVideoSelection;
}

void SConnection::initialiseProtocol()
{
cp.writeVersion(os);
@@ -464,10 +470,16 @@ void SConnection::sendInteractionCaps()
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.

+ 8
- 0
common/rfb/SConnection.h View File

@@ -50,6 +50,11 @@ namespace rfb {
// (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.
@@ -198,6 +203,9 @@ namespace rfb {
SSecurityFactory* securityFactory;
stateEnum state_;
bool reverseConnection;

// TightVNC-specific protocol options.
bool m_videoSelectionEnabled;
};
}
#endif

+ 15
- 0
common/rfb/SMsgReader.cxx View File

@@ -110,3 +110,18 @@ void SMsgReader::readEnableContinuousUpdates()
}
}

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.
}


+ 1
- 0
common/rfb/SMsgReader.h View File

@@ -49,6 +49,7 @@ namespace rfb {

// Read TightVNC-specific protocol messages.
virtual void readEnableContinuousUpdates();
virtual void readVideoRectangleSelection();

SMsgReader(SMsgHandler* handler, rdr::InStream* is);


+ 1
- 0
common/rfb/SMsgReaderV3.cxx View File

@@ -62,6 +62,7 @@ void SMsgReaderV3::readMsg()
case msgTypeFileDeleteRequest: handler->processFTMsg(msgType); break;

case msgTypeEnableContinuousUpdates: readEnableContinuousUpdates(); break;
case msgTypeVideoRectangleSelection: readVideoRectangleSelection(); break;

default:
fprintf(stderr, "unknown message type %d\n", msgType);

+ 1
- 0
common/rfb/VNCSConnectionST.cxx View File

@@ -87,6 +87,7 @@ VNCSConnectionST::~VNCSConnectionST()
bool VNCSConnectionST::init()
{
try {
setProtocolOptions(server->isVideoSelectionEnabled());
initialiseProtocol();
} catch (rdr::Exception& e) {
close(e.str());

+ 2
- 1
common/rfb/VNCServerST.cxx View File

@@ -77,7 +77,8 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_,
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);

+ 12
- 0
common/rfb/VNCServerST.h View File

@@ -192,6 +192,16 @@ namespace rfb {

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;
@@ -239,6 +249,8 @@ namespace rfb {
time_t lastConnectionTime;

bool disableclients;

bool m_videoSelectionEnabled;
};

};

+ 1
- 0
common/rfb/msgTypes.h View File

@@ -57,5 +57,6 @@ namespace rfb {
const int msgTypeFileDeleteRequest = 139;

const int msgTypeEnableContinuousUpdates = 150;
const int msgTypeVideoRectangleSelection = 151;
}
#endif

+ 2
- 0
unix/x0vncserver/x0vncserver.cxx View File

@@ -455,9 +455,11 @@ int main(int argc, char** argv)
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);

Loading…
Cancel
Save