mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
keybindings: Give dynamic keybindings a keybindings action
https://bugzilla.gnome.org/show_bug.cgi?id=682315
This commit is contained in:
parent
576384a73b
commit
d78de379cc
@ -610,10 +610,10 @@ add_builtin_keybinding (MetaDisplay *display,
|
|||||||
*
|
*
|
||||||
* Use meta_display_remove_keybinding() to remove the binding.
|
* Use meta_display_remove_keybinding() to remove the binding.
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the keybinding was added successfully,
|
* Returns: the corresponding keybinding action if the keybinding was
|
||||||
* otherwise %FALSE
|
* added successfully, otherwise %META_KEYBINDING_ACTION_NONE
|
||||||
*/
|
*/
|
||||||
gboolean
|
guint
|
||||||
meta_display_add_keybinding (MetaDisplay *display,
|
meta_display_add_keybinding (MetaDisplay *display,
|
||||||
const char *name,
|
const char *name,
|
||||||
GSettings *settings,
|
GSettings *settings,
|
||||||
@ -622,9 +622,15 @@ meta_display_add_keybinding (MetaDisplay *display,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify free_data)
|
GDestroyNotify free_data)
|
||||||
{
|
{
|
||||||
return add_keybinding_internal (display, name, settings, flags,
|
static guint num_dynamic_bindings = 0;
|
||||||
META_KEYBINDING_ACTION_NONE,
|
guint new_action = META_KEYBINDING_ACTION_LAST + num_dynamic_bindings;
|
||||||
handler, 0, user_data, free_data);
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -656,15 +662,15 @@ meta_display_remove_keybinding (MetaDisplay *display,
|
|||||||
* @keycode: Raw keycode
|
* @keycode: Raw keycode
|
||||||
* @mask: Event mask
|
* @mask: Event mask
|
||||||
*
|
*
|
||||||
* Get the #MetaKeyBindingAction bound to %keycode. Only builtin
|
* Get the keybinding action bound to @keycode. Builtin keybindings
|
||||||
* keybindings have an associated #MetaKeyBindingAction, for
|
* have a fixed associated #MetaKeyBindingAction, for bindings added
|
||||||
* bindings added dynamically with meta_display_add_keybinding()
|
* dynamically the function will return the keybinding action
|
||||||
* the function will always return %META_KEYBINDING_ACTION_NONE.
|
* meta_display_add_keybinding() returns on registration.
|
||||||
*
|
*
|
||||||
* Returns: The action that should be taken for the given key, or
|
* Returns: The action that should be taken for the given key, or
|
||||||
* %META_KEYBINDING_ACTION_NONE.
|
* %META_KEYBINDING_ACTION_NONE.
|
||||||
*/
|
*/
|
||||||
MetaKeyBindingAction
|
guint
|
||||||
meta_display_get_keybinding_action (MetaDisplay *display,
|
meta_display_get_keybinding_action (MetaDisplay *display,
|
||||||
unsigned int keycode,
|
unsigned int keycode,
|
||||||
unsigned long mask)
|
unsigned long mask)
|
||||||
@ -689,7 +695,7 @@ meta_display_get_keybinding_action (MetaDisplay *display,
|
|||||||
binding = display_get_keybinding (display, META_KEY_ABOVE_TAB, keycode, mask);
|
binding = display_get_keybinding (display, META_KEY_ABOVE_TAB, keycode, mask);
|
||||||
|
|
||||||
if (binding)
|
if (binding)
|
||||||
return meta_prefs_get_keybinding_action (binding->name);
|
return (guint) meta_prefs_get_keybinding_action (binding->name);
|
||||||
else
|
else
|
||||||
return META_KEYBINDING_ACTION_NONE;
|
return META_KEYBINDING_ACTION_NONE;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ void meta_display_end_grab_op (MetaDisplay *display,
|
|||||||
|
|
||||||
MetaGrabOp meta_display_get_grab_op (MetaDisplay *display);
|
MetaGrabOp meta_display_get_grab_op (MetaDisplay *display);
|
||||||
|
|
||||||
gboolean meta_display_add_keybinding (MetaDisplay *display,
|
guint meta_display_add_keybinding (MetaDisplay *display,
|
||||||
const char *name,
|
const char *name,
|
||||||
GSettings *settings,
|
GSettings *settings,
|
||||||
MetaKeyBindingFlags flags,
|
MetaKeyBindingFlags flags,
|
||||||
@ -137,7 +137,7 @@ gboolean meta_display_add_keybinding (MetaDisplay *display,
|
|||||||
gboolean meta_display_remove_keybinding (MetaDisplay *display,
|
gboolean meta_display_remove_keybinding (MetaDisplay *display,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
||||||
MetaKeyBindingAction meta_display_get_keybinding_action (MetaDisplay *display,
|
guint meta_display_get_keybinding_action (MetaDisplay *display,
|
||||||
unsigned int keycode,
|
unsigned int keycode,
|
||||||
unsigned long mask);
|
unsigned long mask);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user