From 00ca387ec7f6a864a35e0baee8c69cc71d60641e Mon Sep 17 00:00:00 2001 From: Andrea Azzarone Date: Wed, 18 Jul 2018 20:33:16 +0200 Subject: [PATCH] keybindings: Add flag param to grab_accelerator Add a 'flags' parameters to meta_display_grab_accelerator. This will allow e.g. gnome-settings-daemon (through the gnome-shell's GrabAccelerator API) to create shorcuts that should descard auto-repeated key events. https://gitlab.gnome.org/GNOME/mutter/merge_requests/169 Closes: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/issues/68 --- src/core/keybindings.c | 6 ++++-- src/meta/display.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 340e2a705..dfd440d3a 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1593,8 +1593,9 @@ handle_external_grab (MetaDisplay *display, guint -meta_display_grab_accelerator (MetaDisplay *display, - const char *accelerator) +meta_display_grab_accelerator (MetaDisplay *display, + const char *accelerator, + MetaKeyBindingFlags flags) { MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBinding *binding; @@ -1636,6 +1637,7 @@ meta_display_grab_accelerator (MetaDisplay *display, binding->handler = HANDLER ("external-grab"); binding->combo = combo; binding->resolved_combo = resolved_combo; + binding->flags = flags; g_hash_table_add (keys->key_bindings, binding); index_binding (keys, binding); diff --git a/src/meta/display.h b/src/meta/display.h index bb4831fba..d58150f26 100644 --- a/src/meta/display.h +++ b/src/meta/display.h @@ -157,8 +157,9 @@ gboolean meta_display_remove_keybinding (MetaDisplay *display, const char *name); META_EXPORT -guint meta_display_grab_accelerator (MetaDisplay *display, - const char *accelerator); +guint meta_display_grab_accelerator (MetaDisplay *display, + const char *accelerator, + MetaKeyBindingFlags flags); META_EXPORT gboolean meta_display_ungrab_accelerator (MetaDisplay *display,