diff options
author | Pierre Ossman <ossman@cendio.se> | 2018-11-05 16:28:57 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2018-12-10 21:19:26 +0100 |
commit | 62b0786cc88b66c365c3f5027793aaa6ea77108d (patch) | |
tree | f7392812c84ef7707aad8cf98bb58e5a8e2b5c49 /common | |
parent | 4a6266f5a7db89e70977c62da1d519a00f9a550d (diff) | |
download | tigervnc-62b0786cc88b66c365c3f5027793aaa6ea77108d.tar.gz tigervnc-62b0786cc88b66c365c3f5027793aaa6ea77108d.zip |
Add support for VMware LED status
Diffstat (limited to 'common')
-rw-r--r-- | common/rfb/CConnection.cxx | 4 | ||||
-rw-r--r-- | common/rfb/CMsgReader.cxx | 16 | ||||
-rw-r--r-- | common/rfb/CMsgReader.h | 1 | ||||
-rw-r--r-- | common/rfb/ClientParams.cxx | 2 | ||||
-rw-r--r-- | common/rfb/SMsgWriter.cxx | 15 | ||||
-rw-r--r-- | common/rfb/encodings.h | 1 |
6 files changed, 34 insertions, 5 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx index 3a6b7448..fcad4053 100644 --- a/common/rfb/CConnection.cxx +++ b/common/rfb/CConnection.cxx @@ -604,8 +604,10 @@ void CConnection::updateEncodings() encodings.push_back(pseudoEncodingDesktopSize); encodings.push_back(pseudoEncodingExtendedDesktopSize); } - if (supportsLEDState) + if (supportsLEDState) { encodings.push_back(pseudoEncodingLEDState); + encodings.push_back(pseudoEncodingVMwareLEDState); + } encodings.push_back(pseudoEncodingDesktopName); encodings.push_back(pseudoEncodingLastRect); diff --git a/common/rfb/CMsgReader.cxx b/common/rfb/CMsgReader.cxx index 55191663..0141e6b4 100644 --- a/common/rfb/CMsgReader.cxx +++ b/common/rfb/CMsgReader.cxx @@ -111,6 +111,10 @@ void CMsgReader::readMsg() break; case pseudoEncodingLEDState: readLEDState(); + break; + case pseudoEncodingVMwareLEDState: + readVMwareLEDState(); + break; case pseudoEncodingQEMUKeyEvent: handler->supportsQEMUKeyEvent(); break; @@ -485,3 +489,15 @@ void CMsgReader::readLEDState() handler->setLEDState(state); } + +void CMsgReader::readVMwareLEDState() +{ + rdr::U32 state; + + state = is->readU32(); + + // As luck has it, this extension uses the same bit definitions, + // so no conversion required + + handler->setLEDState(state); +} diff --git a/common/rfb/CMsgReader.h b/common/rfb/CMsgReader.h index 029e95c1..03f3d8d2 100644 --- a/common/rfb/CMsgReader.h +++ b/common/rfb/CMsgReader.h @@ -67,6 +67,7 @@ namespace rfb { void readSetDesktopName(int x, int y, int w, int h); void readExtendedDesktopSize(int x, int y, int w, int h); void readLEDState(); + void readVMwareLEDState(); CMsgHandler* handler; rdr::InStream* is; diff --git a/common/rfb/ClientParams.cxx b/common/rfb/ClientParams.cxx index bf2caa47..e42d494b 100644 --- a/common/rfb/ClientParams.cxx +++ b/common/rfb/ClientParams.cxx @@ -162,6 +162,8 @@ bool ClientParams::supportsLEDState() const { if (supportsEncoding(pseudoEncodingLEDState)) return true; + if (supportsEncoding(pseudoEncodingVMwareLEDState)) + return true; return false; } diff --git a/common/rfb/SMsgWriter.cxx b/common/rfb/SMsgWriter.cxx index 2d59dde3..6a2c2ba0 100644 --- a/common/rfb/SMsgWriter.cxx +++ b/common/rfb/SMsgWriter.cxx @@ -153,7 +153,8 @@ void SMsgWriter::writeCursor() void SMsgWriter::writeLEDState() { - if (!client->supportsEncoding(pseudoEncodingLEDState)) + if (!client->supportsEncoding(pseudoEncodingLEDState) && + !client->supportsEncoding(pseudoEncodingVMwareLEDState)) throw Exception("Client does not support LED state"); if (client->ledState() == ledUnknown) throw Exception("Server has not specified LED state"); @@ -532,7 +533,8 @@ void SMsgWriter::writeSetVMwareCursorRect(int width, int height, void SMsgWriter::writeLEDStateRect(rdr::U8 state) { - if (!client->supportsEncoding(pseudoEncodingLEDState)) + if (!client->supportsEncoding(pseudoEncodingLEDState) && + !client->supportsEncoding(pseudoEncodingVMwareLEDState)) throw Exception("Client does not support LED state updates"); if (client->ledState() == ledUnknown) throw Exception("Server does not support LED state updates"); @@ -543,8 +545,13 @@ void SMsgWriter::writeLEDStateRect(rdr::U8 state) os->writeS16(0); os->writeU16(0); os->writeU16(0); - os->writeU32(pseudoEncodingLEDState); - os->writeU8(state); + if (client->supportsEncoding(pseudoEncodingLEDState)) { + os->writeU32(pseudoEncodingLEDState); + os->writeU8(state); + } else { + os->writeU32(pseudoEncodingVMwareLEDState); + os->writeU32(state); + } } void SMsgWriter::writeQEMUKeyEventRect() diff --git a/common/rfb/encodings.h b/common/rfb/encodings.h index 315ff54c..acb86ecc 100644 --- a/common/rfb/encodings.h +++ b/common/rfb/encodings.h @@ -61,6 +61,7 @@ namespace rfb { // VMware-specific const int pseudoEncodingVMwareCursor = 0x574d5664; + const int pseudoEncodingVMwareLEDState = 0x574d5668; int encodingNum(const char* name); const char* encodingName(int num); |