<div dir="ltr">H<br><div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 3, 2016 at 5:41 PM Pavel Grunt <<a href="mailto:pgrunt@redhat.com">pgrunt@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It will help in cases where syncing modifiers keys is complicated:<br class="gmail_msg">
 * not working leds for modifiers keys<br class="gmail_msg">
 * different keyboard layout on the guest side<br class="gmail_msg"></blockquote><div><br></div><div>Since it's only for testing (isn't it?), wouldn't an environment variable be a better fit? It would work with any client.<br><br></div><div>thanks<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br class="gmail_msg">
 src/spice-gtk-session.c | 30 ++++++++++++++++++++++++++++++<br class="gmail_msg">
 1 file changed, 30 insertions(+)<br class="gmail_msg">
<br class="gmail_msg">
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c<br class="gmail_msg">
index 27623f0..bbcbeeb 100644<br class="gmail_msg">
--- a/src/spice-gtk-session.c<br class="gmail_msg">
+++ b/src/spice-gtk-session.c<br class="gmail_msg">
@@ -65,6 +65,7 @@ struct _SpiceGtkSessionPrivate {<br class="gmail_msg">
     gboolean                pointer_grabbed;<br class="gmail_msg">
     gboolean                keyboard_has_focus;<br class="gmail_msg">
     gboolean                mouse_has_pointer;<br class="gmail_msg">
+    gboolean                sync_modifiers;<br class="gmail_msg">
 };<br class="gmail_msg">
<br class="gmail_msg">
 /**<br class="gmail_msg">
@@ -118,6 +119,7 @@ enum {<br class="gmail_msg">
     PROP_AUTO_CLIPBOARD,<br class="gmail_msg">
     PROP_AUTO_USBREDIR,<br class="gmail_msg">
     PROP_POINTER_GRABBED,<br class="gmail_msg">
+    PROP_SYNC_MODIFIERS,<br class="gmail_msg">
 };<br class="gmail_msg">
<br class="gmail_msg">
 static guint32 get_keyboard_lock_modifiers(void)<br class="gmail_msg">
@@ -185,6 +187,11 @@ static void spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSessio<br class="gmail_msg">
<br class="gmail_msg">
     g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs));<br class="gmail_msg">
<br class="gmail_msg">
+    if (SPICE_IS_GTK_SESSION(self) && !self->priv->sync_modifiers) {<br class="gmail_msg">
+        SPICE_DEBUG("Syncing modifiers is disabled");<br class="gmail_msg">
+        return;<br class="gmail_msg">
+    }<br class="gmail_msg">
+<br class="gmail_msg">
     g_object_get(inputs, "key-modifiers", &guest_modifiers, NULL);<br class="gmail_msg">
     client_modifiers = get_keyboard_lock_modifiers();<br class="gmail_msg">
<br class="gmail_msg">
@@ -332,6 +339,9 @@ static void spice_gtk_session_get_property(GObject    *gobject,<br class="gmail_msg">
     case PROP_POINTER_GRABBED:<br class="gmail_msg">
         g_value_set_boolean(value, s->pointer_grabbed);<br class="gmail_msg">
         break;<br class="gmail_msg">
+    case PROP_SYNC_MODIFIERS:<br class="gmail_msg">
+        g_value_set_boolean(value, s->sync_modifiers);<br class="gmail_msg">
+        break;<br class="gmail_msg">
     default:<br class="gmail_msg">
        G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);<br class="gmail_msg">
        break;<br class="gmail_msg">
@@ -379,6 +389,9 @@ static void spice_gtk_session_set_property(GObject      *gobject,<br class="gmail_msg">
         }<br class="gmail_msg">
         break;<br class="gmail_msg">
     }<br class="gmail_msg">
+    case PROP_SYNC_MODIFIERS:<br class="gmail_msg">
+        s->sync_modifiers = g_value_get_boolean(value);<br class="gmail_msg">
+        break;<br class="gmail_msg">
     default:<br class="gmail_msg">
         G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);<br class="gmail_msg">
         break;<br class="gmail_msg">
@@ -467,6 +480,23 @@ static void spice_gtk_session_class_init(SpiceGtkSessionClass *klass)<br class="gmail_msg">
                               G_PARAM_READABLE |<br class="gmail_msg">
                               G_PARAM_STATIC_STRINGS));<br class="gmail_msg">
<br class="gmail_msg">
+    /**<br class="gmail_msg">
+     * SpiceGtkSession:sync-modifiers:<br class="gmail_msg">
+     *<br class="gmail_msg">
+     * Automatically sync modifiers (Caps, Num and Scroll locks) with the guest.<br class="gmail_msg">
+     *<br class="gmail_msg">
+     * Since: 0.32<br class="gmail_msg">
+     **/<br class="gmail_msg">
+    g_object_class_install_property<br class="gmail_msg">
+        (gobject_class, PROP_SYNC_MODIFIERS,<br class="gmail_msg">
+         g_param_spec_boolean("sync-modifiers",<br class="gmail_msg">
+                              "Sync modifiers",<br class="gmail_msg">
+                              "Automatically sync modifiers",<br class="gmail_msg">
+                              TRUE,<br class="gmail_msg">
+                              G_PARAM_READWRITE |<br class="gmail_msg">
+                              G_PARAM_CONSTRUCT |<br class="gmail_msg">
+                              G_PARAM_STATIC_STRINGS));<br class="gmail_msg">
+<br class="gmail_msg">
     g_type_class_add_private(klass, sizeof(SpiceGtkSessionPrivate));<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
2.8.2<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Spice-devel mailing list<br class="gmail_msg">
<a href="mailto:Spice-devel@lists.freedesktop.org" class="gmail_msg" target="_blank">Spice-devel@lists.freedesktop.org</a><br class="gmail_msg">
<a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br class="gmail_msg">
</blockquote></div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marc-André Lureau<br></div></div>