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
This commit is contained in:
Andrea Azzarone 2018-07-18 20:33:16 +02:00 committed by Carlos Garnacho
parent 5688f1cf6e
commit 00ca387ec7
2 changed files with 7 additions and 4 deletions

View File

@ -1593,8 +1593,9 @@ handle_external_grab (MetaDisplay *display,
guint guint
meta_display_grab_accelerator (MetaDisplay *display, meta_display_grab_accelerator (MetaDisplay *display,
const char *accelerator) const char *accelerator,
MetaKeyBindingFlags flags)
{ {
MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBindingManager *keys = &display->key_binding_manager;
MetaKeyBinding *binding; MetaKeyBinding *binding;
@ -1636,6 +1637,7 @@ meta_display_grab_accelerator (MetaDisplay *display,
binding->handler = HANDLER ("external-grab"); binding->handler = HANDLER ("external-grab");
binding->combo = combo; binding->combo = combo;
binding->resolved_combo = resolved_combo; binding->resolved_combo = resolved_combo;
binding->flags = flags;
g_hash_table_add (keys->key_bindings, binding); g_hash_table_add (keys->key_bindings, binding);
index_binding (keys, binding); index_binding (keys, binding);

View File

@ -157,8 +157,9 @@ gboolean meta_display_remove_keybinding (MetaDisplay *display,
const char *name); const char *name);
META_EXPORT META_EXPORT
guint meta_display_grab_accelerator (MetaDisplay *display, guint meta_display_grab_accelerator (MetaDisplay *display,
const char *accelerator); const char *accelerator,
MetaKeyBindingFlags flags);
META_EXPORT META_EXPORT
gboolean meta_display_ungrab_accelerator (MetaDisplay *display, gboolean meta_display_ungrab_accelerator (MetaDisplay *display,