mirror of
https://github.com/brl/mutter.git
synced 2024-11-13 09:46:08 -05:00
keybindings: Generalize mechanism to generate dynamic keybinding actions
https://bugzilla.gnome.org/show_bug.cgi?id=643111
This commit is contained in:
parent
64c523c534
commit
4df3e987c6
@ -542,6 +542,12 @@ display_get_keybinding (MetaDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static guint
|
||||
next_dynamic_keybinding_action () {
|
||||
static guint num_dynamic_bindings = 0;
|
||||
return META_KEYBINDING_ACTION_LAST + (++num_dynamic_bindings);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_keybinding_internal (MetaDisplay *display,
|
||||
const char *name,
|
||||
@ -622,14 +628,12 @@ meta_display_add_keybinding (MetaDisplay *display,
|
||||
gpointer user_data,
|
||||
GDestroyNotify free_data)
|
||||
{
|
||||
static guint num_dynamic_bindings = 0;
|
||||
guint new_action = META_KEYBINDING_ACTION_LAST + num_dynamic_bindings;
|
||||
guint new_action = next_dynamic_keybinding_action ();
|
||||
|
||||
if (!add_keybinding_internal (display, name, settings, flags, new_action,
|
||||
handler, 0, user_data, free_data))
|
||||
return META_KEYBINDING_ACTION_NONE;
|
||||
|
||||
++num_dynamic_bindings;
|
||||
return new_action;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user