[Spice-devel] [PATCH spice-gtk 2/3] main: do not always request client mouse mode

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


Whenever the mouse mode changed on the server, spice-gtk was requesting
client mode. Move this reqest during init only, so that if the mouse
mode was changed by user, it is not being forced to client again.
---
 gtk/channel-main.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 335c993..7bc0ffb 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1402,20 +1402,6 @@ static void set_mouse_mode(SpiceMainChannel *channel, uint32_t supported, uint32
         g_coroutine_signal_emit(channel, signals[SPICE_MAIN_MOUSE_UPDATE], 0);
         g_coroutine_object_notify(G_OBJECT(channel), "mouse-mode");
     }
-
-    /* switch to client mode if possible */
-    if (!spice_channel_get_read_only(SPICE_CHANNEL(channel)) &&
-        supported & SPICE_MOUSE_MODE_CLIENT &&
-        current != SPICE_MOUSE_MODE_CLIENT) {
-        SpiceMsgcMainMouseModeRequest req = {
-            .mode = SPICE_MOUSE_MODE_CLIENT,
-        };
-        SpiceMsgOut *out;
-
-        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_internal(out);
-    }
 }
 
 /* coroutine context */
@@ -1432,6 +1418,11 @@ static void main_handle_init(SpiceChannel *channel, SpiceMsgIn *in)
     set_mouse_mode(SPICE_MAIN_CHANNEL(channel), init->supported_mouse_modes,
                    init->current_mouse_mode);
 
+    /* switch to client mode if possible */
+    if (init->current_mouse_mode != SPICE_MOUSE_MODE_CLIENT &&
+        init->supported_mouse_modes & SPICE_MOUSE_MODE_CLIENT)
+        spice_main_request_mouse_mode(SPICE_MAIN_CHANNEL(channel), SPICE_MOUSE_MODE_CLIENT);
+
     spice_session_set_mm_time(session, init->multi_media_time);
     spice_session_set_caches_hints(session, init->ram_hint, init->display_channels_hint);
 
-- 
2.1.0



More information about the Spice-devel mailing list