On Mon, 2016-02-15 at 16:01 +0000, Frediano Ziglio wrote: > This duplicate the other list which will be removed > > Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > --- > server/red-dispatcher.c | 22 +++++++++------------- > server/red-dispatcher.h | 2 +- > server/reds-private.h | 2 +- > server/reds.c | 15 +++++++++++---- > 4 files changed, 22 insertions(+), 19 deletions(-) > > diff --git a/server/red-dispatcher.c b/server/red-dispatcher.c > index 9ec760f..68423a1 100644 > --- a/server/red-dispatcher.c > +++ b/server/red-dispatcher.c > @@ -713,19 +713,6 @@ void red_dispatcher_on_sv_change(void) > } > } > > -void red_dispatcher_set_mouse_mode(uint32_t mode) > -{ > - RedWorkerMessageSetMouseMode payload; > - RedDispatcher *now = dispatchers; > - while (now) { > - payload.mode = mode; > - dispatcher_send_message(&now->dispatcher, > - RED_WORKER_MESSAGE_SET_MOUSE_MODE, > - &payload); > - now = now->next; > - } > -} > - > void red_dispatcher_on_vm_stop(void) > { > RedDispatcher *now = dispatchers; > @@ -1101,3 +1088,12 @@ void > red_dispatcher_clear_pending(RedDispatcher *red_dispatcher, int > pending) > > clear_bit(pending, &red_dispatcher->pending); > } > + > +void red_dispatcher_set_mouse_mode(RedDispatcher *dispatcher, > uint32_t mode) > +{ > + RedWorkerMessageSetMouseMode payload; > + payload.mode = mode; > + dispatcher_send_message(&dispatcher->dispatcher, > + RED_WORKER_MESSAGE_SET_MOUSE_MODE, > + &payload); > +} > diff --git a/server/red-dispatcher.h b/server/red-dispatcher.h > index 4aa5854..1c0c218 100644 > --- a/server/red-dispatcher.h > +++ b/server/red-dispatcher.h > @@ -28,7 +28,7 @@ void red_dispatcher_init(QXLInstance *qxl); > > void red_dispatcher_on_ic_change(void); > void red_dispatcher_on_sv_change(void); > -void red_dispatcher_set_mouse_mode(uint32_t mode); > +void red_dispatcher_set_mouse_mode(RedDispatcher *dispatcher, > uint32_t mode); > void red_dispatcher_on_vm_stop(void); > void red_dispatcher_on_vm_start(void); > int red_dispatcher_count(void); > diff --git a/server/reds-private.h b/server/reds-private.h > index 2272d4c..c214091 100644 > --- a/server/reds-private.h > +++ b/server/reds-private.h > @@ -241,7 +241,7 @@ struct RedsState { > > RedSSLParameters ssl_parameters; > SpiceCoreInterfaceInternal *core; > - > + GList *dispatchers; > }; > > #endif > diff --git a/server/reds.c b/server/reds.c > index 418f89a..3882477 100644 > --- a/server/reds.c > +++ b/server/reds.c > @@ -556,11 +556,16 @@ int reds_get_mouse_mode(RedsState *reds) > > static void reds_set_mouse_mode(RedsState *reds, uint32_t mode) > { > + GList *l; > + > if (reds->mouse_mode == mode) { > return; > } > reds->mouse_mode = mode; > - red_dispatcher_set_mouse_mode(reds->mouse_mode); > + > + for (l = reds->dispatchers; l != NULL; l = l->next) > + red_dispatcher_set_mouse_mode(l->data, mode); > + > main_channel_push_mouse_mode(reds->main_channel, reds- > >mouse_mode, reds->is_client_mouse_allowed); > } > > @@ -572,9 +577,10 @@ gboolean reds_get_agent_mouse(const RedsState > *reds) > static void reds_update_mouse_mode(RedsState *reds) > { > int allowed = 0; > + int qxl_count = g_list_length(reds->dispatchers); > > if ((reds->agent_mouse && reds->vdagent) || > - (inputs_channel_has_tablet(reds->inputs_channel))) { > + (inputs_channel_has_tablet(reds->inputs_channel) && > qxl_count == 1)) { This part makes me think that this patch is not rebased on git master. This change, specifically, was introduced by commit deb6afc325127e7c1df6ff34f9da6ac3218e3a76 > allowed = reds->dispatcher_allows_client_mouse; > } > if (allowed == reds->is_client_mouse_allowed) { > @@ -1668,7 +1674,7 @@ static void reds_handle_main_link(RedsState > *reds, RedLinkInfo *link) > } > > if (!mig_target) { > - main_channel_push_init(mcc, red_dispatcher_count(), > + main_channel_push_init(mcc, g_list_length(reds- > >dispatchers), > reds->mouse_mode, reds->is_client_mouse_allowed, > reds_get_mm_time() - MM_TIME_DELTA, > red_dispatcher_qxl_ram_size()); > @@ -1814,7 +1820,7 @@ void > reds_on_client_semi_seamless_migrate_complete(RedsState *reds, > RedClient *c > mcc = red_client_get_main(client); > > // TODO: not doing net test. consider doing it on > client_migrate_info > - main_channel_push_init(mcc, red_dispatcher_count(), > + main_channel_push_init(mcc, g_list_length(reds->dispatchers), > reds->mouse_mode, reds- > >is_client_mouse_allowed, > reds_get_mm_time() - MM_TIME_DELTA, > red_dispatcher_qxl_ram_size()); > @@ -3196,6 +3202,7 @@ SPICE_GNUC_VISIBLE int > spice_server_add_interface(SpiceServer *s, > qxl->st->scanout.drm_dma_buf_fd = -1; > qxl->st->qif = SPICE_CONTAINEROF(interface, QXLInterface, > base); > red_dispatcher_init(qxl); > + reds->dispatchers = g_list_prepend(reds->dispatchers, qxl- > >st->dispatcher); > > } else if (strcmp(interface->type, SPICE_INTERFACE_TABLET) == 0) > { > SpiceTabletInstance *tablet = SPICE_CONTAINEROF(sin, > SpiceTabletInstance, base); Patch, per si, looks good. I'd go for it when rebased on git master. Acked-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx> _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel