[Spice-devel] [PATCHv2 spice-gtk 1/3] gtk: add spice_main_request_mouse_mode()
Marc-André Lureau
marcandre.lureau at gmail.com
Mon May 9 13:02:45 UTC 2016
From: Marc-André Lureau <marcandre.lureau at redhat.com>
Send a SpiceMsgcMainMouseModeRequest message to request a mouse mode.
This allows to switch between client/absolute and server/relative mouse
modes.
This is necessary for some applications that require pointer
re-positioning, which we can't provide through a remote protocol easily
with client pointer (no such hardware-level message exists afaik).
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Reviewed-by: Victor Toso <victortoso at redhat.com>
---
doc/reference/spice-gtk-sections.txt | 1 +
src/channel-main.c | 29 +++++++++++++++++++++++++++++
src/channel-main.h | 2 ++
src/map-file | 1 +
src/spice-glib-sym-file | 1 +
5 files changed, 34 insertions(+)
diff --git a/doc/reference/spice-gtk-sections.txt b/doc/reference/spice-gtk-sections.txt
index a6fcfbf..b67dd35 100644
--- a/doc/reference/spice-gtk-sections.txt
+++ b/doc/reference/spice-gtk-sections.txt
@@ -70,6 +70,7 @@ spice_main_update_display
spice_main_update_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/src/channel-main.c b/src/channel-main.c
index 3966e49..1fef6da 100644
--- a/src/channel-main.c
+++ b/src/channel-main.c
@@ -1602,6 +1602,35 @@ 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. The server may not be able to
+ * change the mouse mode, but spice-gtk will try to request it
+ * when possible.
+ *
+ * Since: 0.32
+ **/
+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/src/channel-main.h b/src/channel-main.h
index 6b94c25..3fe8df1 100644
--- a/src/channel-main.h
+++ b/src/channel-main.h
@@ -98,6 +98,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/src/map-file b/src/map-file
index 589da21..8618f6e 100644
--- a/src/map-file
+++ b/src/map-file
@@ -74,6 +74,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/src/spice-glib-sym-file b/src/spice-glib-sym-file
index 0657dcb..7d2af60 100644
--- a/src/spice-glib-sym-file
+++ b/src/spice-glib-sym-file
@@ -53,6 +53,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.7.4
More information about the Spice-devel
mailing list