[Spice-devel] [PATCH spice-gtk 1/3] gtk: add spice_main_request_mouse_mode()

Marc-André Lureau marcandre.lureau at redhat.com
Fri Mar 27 08:28:57 PDT 2015


Send a SpiceMsgcMainMouseModeRequest message to request a mouse mode.
This allows to switch between client/absolute and server/relative
mouse modes.
---
 doc/reference/spice-gtk-sections.txt |  1 +
 gtk/channel-main.c                   | 28 ++++++++++++++++++++++++++++
 gtk/channel-main.h                   |  2 ++
 gtk/map-file                         |  1 +
 gtk/spice-glib-sym-file              |  1 +
 5 files changed, 33 insertions(+)

diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt
index 5d7b176..50a6070 100644
--- a/doc/reference/spice-gtk-sections.txt
+++ b/doc/reference/spice-gtk-sections.txt
@@ -65,6 +65,7 @@ spice_main_set_display
 spice_main_set_display_enabled
 spice_main_send_monitor_config
 spice_main_agent_test_capability
+spice_main_request_mouse_mode
 spice_main_clipboard_selection_grab
 spice_main_clipboard_selection_notify
 spice_main_clipboard_selection_release
diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 82169aa..335c993 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1364,6 +1364,34 @@ static void agent_stopped(SpiceMainChannel *channel)
     set_agent_connected(channel, FALSE);
 }
 
+
+/**
+ * spice_main_request_mouse_mode:
+ * @channel: a %SpiceMainChannel
+ * @mode: a SPICE_MOUSE_MODE
+ *
+ * Request a mouse mode to the server.
+ *
+ * Since: 0.29
+ **/
+void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode)
+{
+    SpiceMsgcMainMouseModeRequest req = {
+        .mode = mode,
+    };
+    SpiceMsgOut *out;
+
+    g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel));
+
+    if (spice_channel_get_read_only(SPICE_CHANNEL(channel)))
+        return;
+
+    CHANNEL_DEBUG(channel, "request mouse mode %d", mode);
+    out = spice_msg_out_new(SPICE_CHANNEL(channel), SPICE_MSGC_MAIN_MOUSE_MODE_REQUEST);
+    out->marshallers->msgc_main_mouse_mode_request(out->marshaller, &req);
+    spice_msg_out_send(out);
+}
+
 /* coroutine context */
 static void set_mouse_mode(SpiceMainChannel *channel, uint32_t supported, uint32_t current)
 {
diff --git a/gtk/channel-main.h b/gtk/channel-main.h
index 3e4fc42..09b1b1d 100644
--- a/gtk/channel-main.h
+++ b/gtk/channel-main.h
@@ -93,6 +93,8 @@ gboolean spice_main_file_copy_finish(SpiceMainChannel *channel,
                                      GAsyncResult *result,
                                      GError **error);
 
+void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode);
+
 #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 67515e2..413b7a5 100644
--- a/gtk/map-file
+++ b/gtk/map-file
@@ -67,6 +67,7 @@ spice_main_clipboard_selection_release;
 spice_main_clipboard_selection_request;
 spice_main_file_copy_async;
 spice_main_file_copy_finish;
+spice_main_request_mouse_mode;
 spice_main_send_monitor_config;
 spice_main_set_display;
 spice_main_set_display_enabled;
diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file
index 3a8da93..229b08a 100644
--- a/gtk/spice-glib-sym-file
+++ b/gtk/spice-glib-sym-file
@@ -44,6 +44,7 @@ spice_main_clipboard_selection_release
 spice_main_clipboard_selection_request
 spice_main_file_copy_async
 spice_main_file_copy_finish
+spice_main_request_mouse_mode
 spice_main_send_monitor_config
 spice_main_set_display
 spice_main_set_display_enabled
-- 
2.1.0



More information about the Spice-devel mailing list