Server-side support for the XCursor encoding


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@188 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/SMsgWriterV3.cxx b/rfb/SMsgWriterV3.cxx
index 20a7280..c34f216 100644
--- a/rfb/SMsgWriterV3.cxx
+++ b/rfb/SMsgWriterV3.cxx
@@ -84,6 +84,32 @@
   os->writeBytes(mask, (width+7)/8 * height);
 }
 
+void SMsgWriterV3::writeSetXCursor(int width, int height, int hotspotX,
+				   int hotspotY, void* data, void* mask)
+{
+  if (!wsccb) return;
+  if (++nRectsInUpdate > nRectsInHeader && nRectsInHeader)
+    throw Exception("SMsgWriterV3::writeSetXCursor: nRects out of sync");
+  os->writeS16(hotspotX);
+  os->writeS16(hotspotY);
+  os->writeU16(width);
+  os->writeU16(height);
+  os->writeU32(pseudoEncodingXCursor);
+  // FIXME: We only support black and white cursors, currently. We
+  // could pass the correct color by using the pix0/pix1 values
+  // returned from getBitmap, in writeSetCursorCallback. However, we
+  // would then need to undo the conversion from rgb to Pixel that is
+  // done by FakeAllocColor. 
+  os->writeU8(0);
+  os->writeU8(0);
+  os->writeU8(0);
+  os->writeU8(255);
+  os->writeU8(255);
+  os->writeU8(255);
+  os->writeBytes(data, (width+7)/8 * height);
+  os->writeBytes(mask, (width+7)/8 * height);
+}
+
 void SMsgWriterV3::writeFramebufferUpdateStart(int nRects)
 {
   startMsg(msgTypeFramebufferUpdate);