[Spice-devel] [RFC] [PATCH spice-gtk 1/4] DND: Add spice_main_dnd_*() for sending dnd message to guest

Dunrong Huang riegamaths at gmail.com
Mon Nov 5 01:01:15 PST 2012


These functions could send dnd message to guest.

For now, there are two types of messages:
1) VD_AGENT_DND_START: when user drags a file and drop to spice
    client, spice client will send this message to notify guest agent
    to prepare for receiving file, file's name and size are included
    in message's data.

2) VD_AGENT_DND_DATA: the message is used to transfer file content.

Signed-off-by: Dunrong Huang <riegamaths at gmail.com>
---
 gtk/channel-main.c      | 16 ++++++++++++++++
 gtk/channel-main.h      |  3 +++
 gtk/map-file            |  2 ++
 gtk/spice-glib-sym-file |  2 ++
 4 files changed, 23 insertions(+)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 6b9ba8d..1f4130f 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -919,6 +919,22 @@ static void monitors_align(VDAgentMonConfig *monitors, int nmonitors)
 #define agent_msg_queue(Channel, Type, Size, Data) \
     agent_msg_queue_many((Channel), (Type), (Data), (Size), NULL)
 
+void spice_main_dnd_start(SpiceMainChannel *channel, void *data, int size)
+{
+    if (data) {
+        agent_msg_queue(channel, VD_AGENT_DND_START, size, data);
+        spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
+    }
+}
+
+void spice_main_dnd_send_data(SpiceMainChannel *channel, void *data, int size)
+{
+    if (data) {
+        agent_msg_queue(channel, VD_AGENT_DND_DATA, size, data);
+        spice_channel_wakeup(SPICE_CHANNEL(channel), FALSE);
+    }
+}
+
 /**
  * spice_main_send_monitor_config:
  * @channel:
diff --git a/gtk/channel-main.h b/gtk/channel-main.h
index 1a5ab54..685b604 100644
--- a/gtk/channel-main.h
+++ b/gtk/channel-main.h
@@ -79,6 +79,9 @@ void spice_main_clipboard_selection_request(SpiceMainChannel *channel, guint sel
 
 gboolean spice_main_agent_test_capability(SpiceMainChannel *channel, guint32 cap);
 
+void spice_main_dnd_start(SpiceMainChannel *channel, void *data, int size);
+void spice_main_dnd_send_data(SpiceMainChannel *channel, void *data, int size);
+
 #ifndef SPICE_DISABLE_DEPRECATED
 SPICE_DEPRECATED_FOR(spice_main_clipboard_selection_grab)
 void spice_main_clipboard_grab(SpiceMainChannel *channel, guint32 *types, int ntypes);
diff --git a/gtk/map-file b/gtk/map-file
index ed2c07f..3b26d1d 100644
--- a/gtk/map-file
+++ b/gtk/map-file
@@ -53,6 +53,8 @@ spice_inputs_motion;
 spice_inputs_position;
 spice_inputs_set_key_locks;
 spice_main_agent_test_capability;
+spice_main_dnd_start;
+spice_main_dnd_send_data;
 spice_main_channel_get_type;
 spice_main_clipboard_grab;
 spice_main_clipboard_notify;
diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file
index 82955f0..35886c8 100644
--- a/gtk/spice-glib-sym-file
+++ b/gtk/spice-glib-sym-file
@@ -29,6 +29,8 @@ spice_inputs_motion
 spice_inputs_position
 spice_inputs_set_key_locks
 spice_main_agent_test_capability
+spice_main_dnd_start
+spice_main_dnd_send_data
 spice_main_channel_get_type
 spice_main_clipboard_grab
 spice_main_clipboard_notify
-- 
1.7.12.4



More information about the Spice-devel mailing list