]> source.dussan.org Git - tigervnc.git/commitdiff
Add support for VMware LED status 775/head
authorPierre Ossman <ossman@cendio.se>
Mon, 5 Nov 2018 15:28:57 +0000 (16:28 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 10 Dec 2018 20:19:26 +0000 (21:19 +0100)
common/rfb/CConnection.cxx
common/rfb/CMsgReader.cxx
common/rfb/CMsgReader.h
common/rfb/ClientParams.cxx
common/rfb/SMsgWriter.cxx
common/rfb/encodings.h

index 3a6b74484df56908be34d1a123120a94d5de989e..fcad40535e1c4d67d4f26cdf6c06f0cb6cb2daad 100644 (file)
@@ -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);
index 55191663b432a70f3b4d40938ccbf93f0a46745a..0141e6b40f791d4a51402e7db13e5bc3ba9d08b1 100644 (file)
@@ -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);
+}
index 029e95c170e6d11e5ce2bcc5d4c3971e242d23b9..03f3d8d2045af8d757a0903d0120917b580bc7a3 100644 (file)
@@ -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;
index bf2caa4702498f5c83402d9fab438c4b10f901a9..e42d494bce49801799eb68a957bb9f97ac8b5f1a 100644 (file)
@@ -162,6 +162,8 @@ bool ClientParams::supportsLEDState() const
 {
   if (supportsEncoding(pseudoEncodingLEDState))
     return true;
+  if (supportsEncoding(pseudoEncodingVMwareLEDState))
+    return true;
   return false;
 }
 
index 2d59dde3f0222f119ca8e57652929bbd7cc201cd..6a2c2ba0bcf23cf70f921b7a395d7fb20cd856d6 100644 (file)
@@ -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()
index 315ff54cc9d3ea9f6b68b432c68bbb2e46a79aeb..acb86ecc31c252f152c266fbca9fc7f90ce0e226 100644 (file)
@@ -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);