On Mon, Nov 09, 2015 at 03:02:08PM +0100, Marc-André Lureau wrote: > Whenever the mouse mode changed on the server, spice-gtk was requesting > client mode. Instead keep the last requested mode and request it > whenever it's possible. > > Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> > --- > src/channel-main.c | 23 ++++++++++------------- > 1 file changed, 10 insertions(+), 13 deletions(-) > > diff --git a/src/channel-main.c b/src/channel-main.c > index f4213d7..a971966 100644 > --- a/src/channel-main.c > +++ b/src/channel-main.c > @@ -125,6 +125,7 @@ typedef enum { > > struct _SpiceMainChannelPrivate { > enum SpiceMouseMode mouse_mode; > + enum SpiceMouseMode requested_mouse_mode; > bool agent_connected; > bool agent_caps_received; > > @@ -294,6 +295,7 @@ static void spice_main_channel_init(SpiceMainChannel *channel) > c->cancellable_volume_info = g_cancellable_new(); > > spice_main_channel_reset_capabilties(SPICE_CHANNEL(channel)); > + c->requested_mouse_mode = SPICE_MOUSE_MODE_CLIENT; > } > > static gint spice_main_get_max_clipboard(SpiceMainChannel *self) > @@ -1627,13 +1629,17 @@ void spice_main_request_mouse_mode(SpiceMainChannel *channel, int mode) > .mode = mode, > }; > SpiceMsgOut *out; > + SpiceMainChannelPrivate *c; > > g_return_if_fail(SPICE_IS_MAIN_CHANNEL(channel)); > + c = channel->priv; > > if (spice_channel_get_read_only(SPICE_CHANNEL(channel))) > return; > > CHANNEL_DEBUG(channel, "request mouse mode %d", mode); > + c->requested_mouse_mode = 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); > @@ -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); > + } If I'm not mistaken, we were requesting client-mode when channel started but not anymore as requested_mouse_mode is initialized with client-mode. Not sure if this could be a problem. Reviewed-by: Victor Toso <victortoso@xxxxxxxxxx> > } > } > > -- > 2.5.0 > > _______________________________________________ > Spice-devel mailing list > Spice-devel@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/spice-devel _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel