Only update the UsbDeviceManager's "auto-connect" property when "auto-usb-redir" is set, otherwise leave it as is. This allows apps to control UsbDeviceManager's "auto-connect" directly, without it getting reset on every keyboard focus change. Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- gtk/spice-gtk-session.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gtk/spice-gtk-session.c b/gtk/spice-gtk-session.c index 3d2483d..af30b4f 100644 --- a/gtk/spice-gtk-session.c +++ b/gtk/spice-gtk-session.c @@ -235,7 +235,14 @@ static void spice_gtk_session_set_property(GObject *gobject, break; case PROP_AUTO_USBREDIR: s->auto_usbredir_enable = g_value_get_boolean(value); - spice_gtk_session_update_keyboard_focus(self, s->keyboard_focus); + if (s->keyboard_focus) { + SpiceUsbDeviceManager *manager = + spice_usb_device_manager_get(s->session, NULL); + if (manager) { + g_object_set(manager, "auto-connect", s->auto_usbredir_enable, + NULL); + } + } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec); @@ -835,16 +842,15 @@ void spice_gtk_session_update_keyboard_focus(SpiceGtkSession *self, SpiceGtkSessionPrivate *s = self->priv; SpiceUsbDeviceManager *manager; - gboolean auto_connect = FALSE; s->keyboard_focus = state; - if (s->auto_usbredir_enable && s->keyboard_focus) - auto_connect = TRUE; + if (!s->auto_usbredir_enable) + return; manager = spice_usb_device_manager_get(s->session, NULL); if (manager) { - g_object_set(manager, "auto-connect", auto_connect, NULL); + g_object_set(manager, "auto-connect", s->keyboard_focus, NULL); } } -- 1.7.10.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel