[gnome-settings-daemon] media-keys: Avoid hard-coded shortcuts not working
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: Avoid hard-coded shortcuts not working
- Date: Wed, 14 Mar 2012 11:21:34 +0000 (UTC)
commit 14baa19e28ed20076dd01b026ecbd4f22dfc9327
Author: Bastien Nocera <hadess hadess net>
Date: Wed Mar 14 11:45:27 2012 +0100
media-keys: Avoid hard-coded shortcuts not working
When a customisable shortcut uses the same keyboard shortcut.
plugins/media-keys/gsd-media-keys-manager.c | 33 ++++++++++++++++++---------
1 files changed, 22 insertions(+), 11 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 8a2de13..3815598 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -537,6 +537,20 @@ gsettings_custom_changed_cb (GSettings *settings,
g_strfreev (bindings);
}
+static void
+add_key (GsdMediaKeysManager *manager, guint i)
+{
+ MediaKey *key;
+
+ key = g_new0 (MediaKey, 1);
+ key->key_type = media_keys[i].key_type;
+ key->settings_key = media_keys[i].settings_key;
+ key->hard_coded = media_keys[i].hard_coded;
+
+ g_ptr_array_add (manager->priv->keys, key);
+
+ grab_media_key (key, manager);
+}
static void
init_kbd (GsdMediaKeysManager *manager)
@@ -550,18 +564,15 @@ init_kbd (GsdMediaKeysManager *manager)
manager->priv->keys = g_ptr_array_new_with_free_func ((GDestroyNotify) media_key_free);
- /* Media keys */
+ /* Media keys
+ * Add hard-coded shortcuts first so that they can't be preempted */
for (i = 0; i < G_N_ELEMENTS (media_keys); i++) {
- MediaKey *key;
-
- key = g_new0 (MediaKey, 1);
- key->key_type = media_keys[i].key_type;
- key->settings_key = media_keys[i].settings_key;
- key->hard_coded = media_keys[i].hard_coded;
-
- g_ptr_array_add (manager->priv->keys, key);
-
- grab_media_key (key, manager);
+ if (media_keys[i].hard_coded)
+ add_key (manager, i);
+ }
+ for (i = 0; i < G_N_ELEMENTS (media_keys); i++) {
+ if (media_keys[i].hard_coded == NULL)
+ add_key (manager, i);
}
/* Custom shortcuts */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]