[Spice-devel] [PATCH] vdagent: receiving a clipboard request with an unsupported type is replied by data with a none type

Arnon Gilboa agilboa at redhat.com
Wed Oct 6 07:41:42 PDT 2010


Currently we send a VD_AGENT_CLIPBOARD_RELEASE when we receive a
VD_AGENT_CLIPBOARD_REQUEST with a type which we do not support. This is not
correct, as this means given up clipboard ownership while we may be able
to answer requests with different types. The correct response is to
nack the request by sending a VD_AGENT_CLIPBOARD (data) message with a type
of VD_AGENT_CLIPBOARD_NONE.(citing hansg)
---
 vdagent/vdagent.cpp |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index bf48e17..f3f571b 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -803,7 +803,7 @@ bool VDAgent::on_clipboard_grab()
     
     //FIXME: use all available types rather than just the first one 
     uint32_t grab_types[] = {type};
-    return write_message(VD_AGENT_CLIPBOARD_GRAB, sizeof(grab_types), &grab_types);  
+    return write_message(VD_AGENT_CLIPBOARD_GRAB, sizeof(grab_types), &grab_types);
 }
 
 // In delayed rendering, Windows requires us to SetClipboardData before we return from
@@ -986,7 +986,8 @@ void VDAgent::dispatch_message(VDAgentMessage* msg, uint32_t port)
     case VD_AGENT_CLIPBOARD_REQUEST:
         res = a->handle_clipboard_request((VDAgentClipboardRequest*)msg->data);
         if (!res) {
-            res = a->write_message(VD_AGENT_CLIPBOARD_RELEASE);
+            VDAgentClipboard clipboard = {VD_AGENT_CLIPBOARD_NONE};
+            res = a->write_message(VD_AGENT_CLIPBOARD, sizeof(clipboard), &clipboard);
         }
         break;
     case VD_AGENT_CLIPBOARD_RELEASE:
-- 
1.5.5.6



More information about the Spice-devel mailing list