The channel state is not synchronous. It may happen that we want to set and unset quickly a modifier, but the guest modifier state hasn't been updated yet, and will still be seen as unset, preventing the last unset change. --- gtk/spice-gtk-session.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c index 922614d..9e74cbc 100644 --- a/gtk/spice-gtk-session.c +++ b/gtk/spice-gtk-session.c @@ -156,32 +156,35 @@ static guint32 get_keyboard_lock_modifiers(void) } static void spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSession *self, - SpiceInputsChannel* inputs) + SpiceInputsChannel* inputs, + gboolean force) { gint guest_modifiers = 0, client_modifiers = 0; g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs)); g_object_get(inputs, "key-modifiers", &guest_modifiers, NULL); - client_modifiers = get_keyboard_lock_modifiers(); - CHANNEL_DEBUG(inputs, "client_modifiers:0x%x, guest_modifiers:0x%x", - client_modifiers, guest_modifiers); - if (client_modifiers != guest_modifiers) + if (force || client_modifiers != guest_modifiers) { + CHANNEL_DEBUG(inputs, "client_modifiers:0x%x, guest_modifiers:0x%x", + client_modifiers, guest_modifiers); spice_inputs_set_key_locks(inputs, client_modifiers); + } } static void keymap_modifiers_changed(GdkKeymap *keymap, gpointer data) { SpiceGtkSession *self = data; + spice_gtk_session_sync_keyboard_modifiers(self); } static void guest_modifiers_changed(SpiceInputsChannel *inputs, gpointer data) { SpiceGtkSession *self = data; - spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs); + + spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs, FALSE); } static void spice_gtk_session_init(SpiceGtkSession *self) @@ -965,7 +968,7 @@ static void channel_new(SpiceSession *session, SpiceChannel *channel, if (SPICE_IS_INPUTS_CHANNEL(channel)) { spice_g_signal_connect_object(channel, "inputs-modifiers", G_CALLBACK(guest_modifiers_changed), self, 0); - spice_gtk_session_sync_keyboard_modifiers_for_channel(self, SPICE_INPUTS_CHANNEL(channel)); + spice_gtk_session_sync_keyboard_modifiers_for_channel(self, SPICE_INPUTS_CHANNEL(channel), TRUE); } } @@ -1132,7 +1135,7 @@ void spice_gtk_session_sync_keyboard_modifiers(SpiceGtkSession *self) for (l = channels; l != NULL; l = l->next) { if (SPICE_IS_INPUTS_CHANNEL(l->data)) { SpiceInputsChannel *inputs = SPICE_INPUTS_CHANNEL(l->data); - spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs); + spice_gtk_session_sync_keyboard_modifiers_for_channel(self, inputs, TRUE); } } } -- 1.8.5.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel