[Spice-devel] [PATCH spice 08/17] Rename platform clipboard handling functions

Hans de Goede hdegoede at redhat.com
Mon Oct 4 03:34:59 PDT 2010


Rename the 4 platform clipboard functions which get called
upon receival of an agent clipboard message to on_clipboard_*

The old set_clipboard_* names were confusing as they suggest being
a class property setter (like set_event_listener) rather then
event handler, and set_clipboard_owner was causing a name conflict
with the next patch in this series.
---
 client/platform.h           |    8 ++++----
 client/red_client.cpp       |    8 ++++----
 client/windows/platform.cpp |    8 ++++----
 client/x11/platform.cpp     |    8 ++++----
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/client/platform.h b/client/platform.h
index 48476cf..ff6f38d 100644
--- a/client/platform.h
+++ b/client/platform.h
@@ -121,10 +121,10 @@ public:
     class ClipboardListener;
     static void set_clipboard_listener(ClipboardListener* listener);
 
-    static bool set_clipboard_owner(uint32_t *types, uint32_t type_count);
-    static bool set_clipboard_data(uint32_t type, const uint8_t* data, int32_t size);
-    static bool request_clipboard_notification(uint32_t type);
-    static void release_clipboard();
+    static bool on_clipboard_grab(uint32_t *types, uint32_t type_count);
+    static bool on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t size);
+    static bool on_clipboard_request(uint32_t type);
+    static void on_clipboard_release();
 };
 
 class Platform::EventListener {
diff --git a/client/red_client.cpp b/client/red_client.cpp
index 666de40..3f01fb1 100644
--- a/client/red_client.cpp
+++ b/client/red_client.cpp
@@ -1087,21 +1087,21 @@ void RedClient::dispatch_agent_message(VDAgentMessage* msg, void* data)
     }
     case VD_AGENT_CLIPBOARD: {
         VDAgentClipboard* clipboard = (VDAgentClipboard*)data;
-        Platform::set_clipboard_data(clipboard->type, clipboard->data,
+        Platform::on_clipboard_notify(clipboard->type, clipboard->data,
                                      msg->size - sizeof(VDAgentClipboard));
         break;
     }
     case VD_AGENT_CLIPBOARD_GRAB:
-        Platform::set_clipboard_owner((uint32_t *)data,
+        Platform::on_clipboard_grab((uint32_t *)data,
                                       msg->size / sizeof(uint32_t));
         break;
     case VD_AGENT_CLIPBOARD_REQUEST:
-        if (!Platform::request_clipboard_notification(((VDAgentClipboardRequest*)data)->type)) {
+        if (!Platform::on_clipboard_request(((VDAgentClipboardRequest*)data)->type)) {
             on_clipboard_notify(VD_AGENT_CLIPBOARD_NONE, NULL, 0);
         }
         break;
     case VD_AGENT_CLIPBOARD_RELEASE:
-        Platform::release_clipboard();
+        Platform::on_clipboard_release();
         break;
     default:
         DBG(0, "Unsupported message type %u size %u", msg->type, msg->size);
diff --git a/client/windows/platform.cpp b/client/windows/platform.cpp
index 2a62944..db6d18a 100644
--- a/client/windows/platform.cpp
+++ b/client/windows/platform.cpp
@@ -856,7 +856,7 @@ void WinPlatform::exit_modal_loop()
     modal_loop_active = false;
 }
 
-bool Platform::set_clipboard_owner(uint32_t *types, uint32_t type_count)
+bool Platform::on_clipboard_grab(uint32_t *types, uint32_t type_count)
 {
     /* FIXME use all types rather then just the first one */
     uint32_t format = get_clipboard_format(types[0]);
@@ -880,7 +880,7 @@ void Platform::set_clipboard_listener(ClipboardListener* listener)
     clipboard_listener = listener ? listener : &default_clipboard_listener;
 }
 
-bool Platform::set_clipboard_data(uint32_t type, const uint8_t* data, int32_t size)
+bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t size)
 {
     HGLOBAL clip_data;
     LPVOID clip_buf;
@@ -946,7 +946,7 @@ bool Platform::set_clipboard_data(uint32_t type, const uint8_t* data, int32_t si
     return ret;
 }
 
-bool Platform::request_clipboard_notification(uint32_t type)
+bool Platform::on_clipboard_request(uint32_t type)
 {
     UINT format = get_clipboard_format(type);
     HANDLE clip_data;
@@ -995,7 +995,7 @@ bool Platform::request_clipboard_notification(uint32_t type)
     return ret;
 }
 
-void Platform::release_clipboard()
+void Platform::on_clipboard_release()
 {
     SetEvent(clipboard_event);
 }
diff --git a/client/x11/platform.cpp b/client/x11/platform.cpp
index 6627187..b7216eb 100644
--- a/client/x11/platform.cpp
+++ b/client/x11/platform.cpp
@@ -3145,7 +3145,7 @@ LocalCursor* Platform::create_default_cursor()
     return new XDefaultCursor();
 }
 
-bool Platform::set_clipboard_owner(uint32_t *types, uint32_t type_count)
+bool Platform::on_clipboard_grab(uint32_t *types, uint32_t type_count)
 {
     Lock lock(clipboard_lock);
     /* FIXME use all types rather then just the first one */
@@ -3166,7 +3166,7 @@ void Platform::set_clipboard_listener(ClipboardListener* listener)
     clipboard_listener = listener ? listener : &default_clipboard_listener;
 }
 
-bool Platform::set_clipboard_data(uint32_t type, const uint8_t* data, int32_t size)
+bool Platform::on_clipboard_notify(uint32_t type, const uint8_t* data, int32_t size)
 {
     Lock lock(clipboard_lock);
     uint32_t format = get_clipboard_format(type);
@@ -3187,7 +3187,7 @@ bool Platform::set_clipboard_data(uint32_t type, const uint8_t* data, int32_t si
     return true;
 }
 
-bool Platform::request_clipboard_notification(uint32_t type)
+bool Platform::on_clipboard_request(uint32_t type)
 {
     uint32_t format = get_clipboard_format(type);
 
@@ -3208,7 +3208,7 @@ bool Platform::request_clipboard_notification(uint32_t type)
     return true;
 }
 
-void Platform::release_clipboard()
+void Platform::on_clipboard_release()
 {
     XSetSelectionOwner(x_display, clipboard_prop, None, CurrentTime);
 }
-- 
1.7.2.2



More information about the Spice-devel mailing list