[Spice-devel] [PATCH vdagent-win 1/6] vdagent: on encoding only, use HBITMAP to keep the correct palette

Arnon Gilboa agilboa at redhat.com
Mon Mar 18 06:41:59 PDT 2013


for decoding, keep using CF_DIB and CxImage.CopyToHandle() as before.

Regression was due to commit da07ce (rhbz #919150)

rhbz #921980
---
 vdagent/vdagent.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index c56025d..1dcfd1a 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -42,7 +42,7 @@ typedef struct VDClipboardFormat {
 VDClipboardFormat clipboard_formats[] = {
     {CF_UNICODETEXT, {VD_AGENT_CLIPBOARD_UTF8_TEXT, 0}},
     //FIXME: support more image types
-    {CF_BITMAP, {VD_AGENT_CLIPBOARD_IMAGE_PNG, VD_AGENT_CLIPBOARD_IMAGE_BMP, 0}},
+    {CF_DIB, {VD_AGENT_CLIPBOARD_IMAGE_PNG, VD_AGENT_CLIPBOARD_IMAGE_BMP, 0}},
 };
 
 #define clipboard_formats_count (sizeof(clipboard_formats) / sizeof(clipboard_formats[0]))
@@ -1008,6 +1008,10 @@ bool VDAgent::handle_clipboard_request(VDAgentClipboardRequest* clipboard_reques
         vd_printf("Unsupported clipboard type %u", clipboard_request->type);
         return false;
     }
+    // on encoding only, we use HBITMAP to keep the correct palette
+    if (format == CF_DIB) {
+        format = CF_BITMAP;
+    }
     if (!IsClipboardFormatAvailable(format) || !OpenClipboard(_hwnd)) {
         return false;
     }
-- 
1.7.7.6



More information about the Spice-devel mailing list