[Spice-commits] 2 commits - src/spice-gtk-session.c src/spicy.c

Pavel Grunt pgrunt at kemper.freedesktop.org
Thu May 12 09:18:49 UTC 2016


 src/spice-gtk-session.c |   30 ++++++++++++++++++++++++++++++
 src/spicy.c             |    6 ++++++
 2 files changed, 36 insertions(+)

New commits:
commit 27156ceaf54a9047522856ee5b6dd487056e2105
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Tue May 3 15:41:23 2016 +0200

    spicy: Add option to control syncing modifiers
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/spicy.c b/src/spicy.c
index 04d707b..cbd8e8b 100644
--- a/src/spicy.c
+++ b/src/spicy.c
@@ -733,6 +733,7 @@ static const char *spice_display_properties[] = {
 static const char *spice_gtk_session_properties[] = {
     "auto-clipboard",
     "auto-usbredir",
+    "sync-modifiers",
 };
 
 static const GtkToggleActionEntry tentries[] = {
@@ -757,6 +758,10 @@ static const GtkToggleActionEntry tentries[] = {
         .label       = "Disable inputs",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
     },{
+        .name        = "sync-modifiers",
+        .label       = "Sync modifiers",
+        .callback    = G_CALLBACK(menu_cb_bool_prop),
+    },{
         .name        = "auto-clipboard",
         .label       = "Automatic clipboard sharing between host and guest",
         .callback    = G_CALLBACK(menu_cb_bool_prop),
@@ -843,6 +848,7 @@ static char ui_xml[] =
 "      <menuitem action='resize-guest'/>\n"
 "      <menuitem action='scaling'/>\n"
 "      <menuitem action='disable-inputs'/>\n"
+"      <menuitem action='sync-modifiers'/>\n"
 "      <menuitem action='auto-clipboard'/>\n"
 "      <menuitem action='auto-usbredir'/>\n"
 "      <menu action='CompressionMenu'>\n"
commit 42e9bc353d4348a95dba858ac231e940ace4465e
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Tue May 3 15:41:22 2016 +0200

    spice-gtk-session: Add sync modifiers property
    
    It will help in cases where syncing modifiers keys is complicated:
     * not working leds for modifiers keys
     * different keyboard layout on the guest side
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index 27623f0..bbcbeeb 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -65,6 +65,7 @@ struct _SpiceGtkSessionPrivate {
     gboolean                pointer_grabbed;
     gboolean                keyboard_has_focus;
     gboolean                mouse_has_pointer;
+    gboolean                sync_modifiers;
 };
 
 /**
@@ -118,6 +119,7 @@ enum {
     PROP_AUTO_CLIPBOARD,
     PROP_AUTO_USBREDIR,
     PROP_POINTER_GRABBED,
+    PROP_SYNC_MODIFIERS,
 };
 
 static guint32 get_keyboard_lock_modifiers(void)
@@ -185,6 +187,11 @@ static void spice_gtk_session_sync_keyboard_modifiers_for_channel(SpiceGtkSessio
 
     g_return_if_fail(SPICE_IS_INPUTS_CHANNEL(inputs));
 
+    if (SPICE_IS_GTK_SESSION(self) && !self->priv->sync_modifiers) {
+        SPICE_DEBUG("Syncing modifiers is disabled");
+        return;
+    }
+
     g_object_get(inputs, "key-modifiers", &guest_modifiers, NULL);
     client_modifiers = get_keyboard_lock_modifiers();
 
@@ -332,6 +339,9 @@ static void spice_gtk_session_get_property(GObject    *gobject,
     case PROP_POINTER_GRABBED:
         g_value_set_boolean(value, s->pointer_grabbed);
         break;
+    case PROP_SYNC_MODIFIERS:
+        g_value_set_boolean(value, s->sync_modifiers);
+        break;
     default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
 	break;
@@ -379,6 +389,9 @@ static void spice_gtk_session_set_property(GObject      *gobject,
         }
         break;
     }
+    case PROP_SYNC_MODIFIERS:
+        s->sync_modifiers = g_value_get_boolean(value);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, pspec);
         break;
@@ -467,6 +480,23 @@ static void spice_gtk_session_class_init(SpiceGtkSessionClass *klass)
                               G_PARAM_READABLE |
                               G_PARAM_STATIC_STRINGS));
 
+    /**
+     * SpiceGtkSession:sync-modifiers:
+     *
+     * Automatically sync modifiers (Caps, Num and Scroll locks) with the guest.
+     *
+     * Since: 0.32
+     **/
+    g_object_class_install_property
+        (gobject_class, PROP_SYNC_MODIFIERS,
+         g_param_spec_boolean("sync-modifiers",
+                              "Sync modifiers",
+                              "Automatically sync modifiers",
+                              TRUE,
+                              G_PARAM_READWRITE |
+                              G_PARAM_CONSTRUCT |
+                              G_PARAM_STATIC_STRINGS));
+
     g_type_class_add_private(klass, sizeof(SpiceGtkSessionPrivate));
 }
 


More information about the Spice-commits mailing list