[gnome-settings-daemon] media-keys: Avoid multiple grab/ungrab pairs on custom binding changes



commit 8966dd939641ecde2d75aeb291634630d2bea148
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Feb 13 16:26:01 2017 +0100

    media-keys: Avoid multiple grab/ungrab pairs on custom binding changes
    
    If there are gsettings changes to a custom binding's gsettings we
    could end up calling update_custom_binding() twice in a row: one for
    the 'binding' setting and one for the 'command' setting. This means
    that we would add the same binding twice and the second addition would
    fail resulting in key->accel_id being set to 0, preventing us from
    handling the binding when it gets activated.
    
    Since we're only interested in changes to the 'binding' setting, we
    can prevent this problem and the extra work we always do by ignoring
    changes to any other setting keys.
    
    Thanks to Matthijs Kooijman (matthijs stdin nl) for debugging and
    pointing out the problem.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=758302

 plugins/media-keys/gsd-media-keys-manager.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index e4b033b..b607019 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -579,7 +579,7 @@ media_key_new_for_path (GsdMediaKeysManager *manager,
        if (settings == NULL) {
                settings = g_settings_new_with_path (CUSTOM_BINDING_SCHEMA, path);
 
-               g_signal_connect (settings, "changed",
+               g_signal_connect (settings, "changed::binding",
                                  G_CALLBACK (custom_binding_changed), manager);
                g_hash_table_insert (manager->priv->custom_settings,
                                     g_strdup (path), settings);
@@ -643,7 +643,7 @@ custom_binding_changed (GSettings           *settings,
 {
         char *path;
 
-        if (strcmp (settings_key, "name") == 0)
+        if (strcmp (settings_key, "binding") != 0)
                 return; /* we don't care */
 
         g_object_get (settings, "path", &path, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]