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

Marc-André Lureau marcandre.lureau at gmail.com
Tue Nov 10 04:16:32 PST 2015


On Mon, Nov 9, 2015 at 3:02 PM, Marc-André Lureau
<marcandre.lureau at redhat.com> wrote:
>      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);
> @@ -1648,20 +1654,11 @@ static void set_mouse_mode(SpiceMainChannel *channel, uint32_t supported, uint32
>          c->mouse_mode = current;
>          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);
> +        if (c->requested_mouse_mode != c->mouse_mode &&
> +            c->requested_mouse_mode & supported) {
> +            spice_main_request_mouse_mode(SPICE_MAIN_CHANNEL(channel), c->requested_mouse_mode);
> +        }
>      }
>  }


actually I moved this added block outside of the first c->mouse_mode =
current block:

+    if (c->requested_mouse_mode != c->mouse_mode &&
+        c->requested_mouse_mode & supported) {
+        spice_main_request_mouse_mode(SPICE_MAIN_CHANNEL(channel),
c->requested_mouse_mode);
     }

That works much better as intended.

-- 
Marc-André Lureau


More information about the Spice-devel mailing list