[Spice-devel] [PATCH] spice-win: handle type VD_AGENT_CLIPBOARD_NONE in Platform::on_clipboard_notify()

Arnon Gilboa agilboa at redhat.com
Wed Oct 6 07:45:48 PDT 2010


---
 client/windows/platform.cpp |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 1157420..3939193 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -105,6 +105,7 @@ static uint32_t get_clipboard_format(uint32_t type) {
     return iter->format;
 }
 
+//FIXME: handle multiple types
 static uint32_t get_available_clipboard_type()
 {
     uint32_t type = 0;
@@ -149,6 +150,7 @@ static LRESULT CALLBACK PlatformWinProc(HWND hWnd, UINT message, WPARAM wParam,
         break;
     case WM_DRAWCLIPBOARD:
         if (!clipboard_changer) {
+            //FIXME: handle multiple types
             uint32_t type = get_available_clipboard_type();            
             if (type) {
                 clipboard_listener->on_clipboard_grab(&type, 1);
@@ -860,12 +862,15 @@ int Platform::_clipboard_owner = Platform::owner_none;
 
 void Platform::set_clipboard_owner(int new_owner)
 {
+    const char * const owner_str[] = { "none", "guest", "client" };
+
     if (new_owner == owner_none) {
         clipboard_listener->on_clipboard_release();
 
         /* FIXME clear cached clipboard type info and data */
     }
     _clipboard_owner = new_owner;
+    LOG_INFO("new clipboard owner: %s", owner_str[new_owner]);
 }
 
 bool Platform::on_clipboard_grab(uint32_t *types, uint32_t type_count)
@@ -901,6 +906,10 @@ bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t s
     UINT format;
     bool ret = false;
 
+    if (type == VD_AGENT_CLIPBOARD_NONE) {
+        SetEvent(clipboard_event);
+        return true;
+    }
     // Get the required clipboard size
     switch (type) {
     case VD_AGENT_CLIPBOARD_UTF8_TEXT:
@@ -913,7 +922,7 @@ bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t s
         break;
     default:
         LOG_INFO("Unsupported clipboard type %u", type);
-        return false;
+        return true;
     }
 
     // Allocate and lock clipboard memory
-- 
1.5.5.6



More information about the Spice-devel mailing list