summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2015-11-09 15:02:07 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2016-05-10 10:56:16 +0200
commit5f89a4df037f6a1f2def94431690bb574d166a0e (patch)
tree8675952bdb2fc0dfaddb1faf89337969c4cac451
parent36b9678e4655b22d027a32ba85b2e85b1f4f1685 (diff)
gtk: add spice_main_request_mouse_mode()
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@redhat.com> Reviewed-by: Victor Toso <victortoso@redhat.com>
-rw-r--r--doc/reference/spice-gtk-sections.txt1
-rw-r--r--src/channel-main.c29
-rw-r--r--src/channel-main.h2
-rw-r--r--src/map-file1
-rw-r--r--src/spice-glib-sym-file1
5 files changed, 34 insertions, 0 deletions
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