[gnome-settings-daemon] media-keys: support grabFlags parameter
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] media-keys: support grabFlags parameter
- Date: Wed, 20 Feb 2019 14:45:24 +0000 (UTC)
commit d8aa135716ac284277d1d694f6c8d016debe8894
Author: Andrea Azzarone <azzaronea gmail com>
Date: Wed Jul 18 19:52:09 2018 +0200
media-keys: support grabFlags parameter
Support the grabFlags parameter of the GrabAccelerator and
GrabAccelerators methods of the DBUS org.gnome.Shell API. For the moment
always use META_KEY_BINDING_NONE.
plugins/media-keys/gsd-media-keys-manager.c | 11 +++++++----
plugins/media-keys/org.gnome.ShellKeyGrabber.xml | 3 ++-
plugins/media-keys/shell-action-modes.h | 18 ++++++++++++++++++
plugins/media-keys/shortcuts-list.h | 1 +
4 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 1576b61c..fd6a5eca 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -142,6 +142,7 @@ typedef struct {
MediaKeyType key_type;
ShellActionMode modes;
+ MetaKeyBindingFlags grab_flags;
const char *settings_key;
const char *hard_coded;
char *custom_path;
@@ -496,7 +497,7 @@ grab_media_keys (GsdMediaKeysManager *manager)
GVariantBuilder builder;
int i;
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(su)"));
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(suu)"));
for (i = 0; i < manager->priv->keys->len; i++) {
MediaKey *key;
@@ -504,13 +505,13 @@ grab_media_keys (GsdMediaKeysManager *manager)
key = g_ptr_array_index (manager->priv->keys, i);
tmp = get_binding (manager, key);
- g_variant_builder_add (&builder, "(su)", tmp, key->modes);
+ g_variant_builder_add (&builder, "(suu)", tmp, key->modes, key->grab_flags);
g_free (tmp);
}
g_dbus_proxy_call (G_DBUS_PROXY (manager->priv->key_grabber),
"GrabAccelerators",
- g_variant_new ("(@a(su))",
+ g_variant_new ("(@a(suu))",
g_variant_builder_end (&builder)),
G_DBUS_CALL_FLAGS_NONE,
SHELL_GRABBER_CALL_TIMEOUT,
@@ -574,7 +575,7 @@ grab_media_key (MediaKey *key,
data->key = media_key_ref (key);
shell_key_grabber_call_grab_accelerator (manager->priv->key_grabber,
- binding, key->modes,
+ binding, key->modes, key->grab_flags,
manager->priv->grab_cancellable,
grab_accelerator_complete,
data);
@@ -706,6 +707,7 @@ media_key_new_for_path (GsdMediaKeysManager *manager,
key->modes = GSD_ACTION_MODE_LAUNCHER;
key->custom_path = g_strdup (path);
key->custom_command = command;
+ key->grab_flags = META_KEY_BINDING_NONE;
return key;
}
@@ -830,6 +832,7 @@ add_key (GsdMediaKeysManager *manager, guint i)
key->settings_key = media_keys[i].settings_key;
key->hard_coded = media_keys[i].hard_coded;
key->modes = media_keys[i].modes;
+ key->grab_flags = media_keys[i].grab_flags;
g_ptr_array_add (manager->priv->keys, key);
}
diff --git a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
index 4a1f7e7d..b99e0df2 100644
--- a/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
+++ b/plugins/media-keys/org.gnome.ShellKeyGrabber.xml
@@ -3,7 +3,8 @@
<annotation name="org.gtk.GDBus.C.Name" value="KeyGrabber"/>
<method name="GrabAccelerator">
<arg type="s" direction="in" name="accelerator"/>
- <arg type="u" direction="in" name="flags"/>
+ <arg type="u" direction="in" name="modeFlags"/>
+ <arg type="u" direction="in" name="grabFlags"/>
<arg type="u" direction="out" name="action"/>
</method>
<method name="UngrabAccelerator">
diff --git a/plugins/media-keys/shell-action-modes.h b/plugins/media-keys/shell-action-modes.h
index a6f4718b..f17a7a03 100644
--- a/plugins/media-keys/shell-action-modes.h
+++ b/plugins/media-keys/shell-action-modes.h
@@ -33,3 +33,21 @@ typedef enum {
SHELL_ACTION_MODE_ALL = ~0,
} ShellActionMode;
+/**
+ * MetaKeyBindingFlags:
+ * @META_KEY_BINDING_NONE: none
+ * @META_KEY_BINDING_PER_WINDOW: per-window
+ * @META_KEY_BINDING_BUILTIN: built-in
+ * @META_KEY_BINDING_IS_REVERSED: is reversed
+ * @META_KEY_BINDING_NON_MASKABLE: always active
+ * @META_KEY_BINDING_IGNORE_AUTOREPEAT: ignore key autorepeat
+ */
+typedef enum
+{
+ META_KEY_BINDING_NONE,
+ META_KEY_BINDING_PER_WINDOW = 1 << 0,
+ META_KEY_BINDING_BUILTIN = 1 << 1,
+ META_KEY_BINDING_IS_REVERSED = 1 << 2,
+ META_KEY_BINDING_NON_MASKABLE = 1 << 3,
+ META_KEY_BINDING_IGNORE_AUTOREPEAT = 1 << 4,
+} MetaKeyBindingFlags;
\ No newline at end of file
diff --git a/plugins/media-keys/shortcuts-list.h b/plugins/media-keys/shortcuts-list.h
index 744352ab..e483aabc 100644
--- a/plugins/media-keys/shortcuts-list.h
+++ b/plugins/media-keys/shortcuts-list.h
@@ -41,6 +41,7 @@ static struct {
const char *key_name;
const char *hard_coded;
ShellActionMode modes;
+ MetaKeyBindingFlags grab_flags;
} media_keys[] = {
{ TOUCHPAD_KEY, NULL, N_("Touchpad toggle") ,"XF86TouchpadToggle", SHELL_ACTION_MODE_ALL },
{ TOUCHPAD_KEY, NULL, N_("Touchpad toggle") ,"<Ctrl><Super>XF86TouchpadToggle",
SHELL_ACTION_MODE_ALL },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]