mirror of
https://github.com/brl/mutter.git
synced 2024-11-28 19:10:43 -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.
|
||||
*
|
||||
* Returns: %TRUE if the keybinding was added successfully,
|
||||
* otherwise %FALSE
|
||||
* Returns: the corresponding keybinding action if the keybinding was
|
||||
* added successfully, otherwise %META_KEYBINDING_ACTION_NONE
|
||||
*/
|
||||
gboolean
|
||||
guint
|
||||
meta_display_add_keybinding (MetaDisplay *display,
|
||||
const char *name,
|
||||
GSettings *settings,
|
||||
@ -622,9 +622,15 @@ meta_display_add_keybinding (MetaDisplay *display,
|
||||
gpointer user_data,
|
||||
GDestroyNotify free_data)
|
||||
{
|
||||
return add_keybinding_internal (display, name, settings, flags,
|
||||
META_KEYBINDING_ACTION_NONE,
|
||||
handler, 0, user_data, free_data);
|
||||
static guint num_dynamic_bindings = 0;
|
||||
guint new_action = META_KEYBINDING_ACTION_LAST + num_dynamic_bindings;
|
||||
|
||||
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
|
||||
* @mask: Event mask
|
||||
*
|
||||
* Get the #MetaKeyBindingAction bound to %keycode. Only builtin
|
||||
* keybindings have an associated #MetaKeyBindingAction, for
|
||||
* bindings added dynamically with meta_display_add_keybinding()
|
||||
* the function will always return %META_KEYBINDING_ACTION_NONE.
|
||||
* Get the keybinding action bound to @keycode. Builtin keybindings
|
||||
* have a fixed associated #MetaKeyBindingAction, for bindings added
|
||||
* dynamically the function will return the keybinding action
|
||||
* meta_display_add_keybinding() returns on registration.
|
||||
*
|
||||
* Returns: The action that should be taken for the given key, or
|
||||
* %META_KEYBINDING_ACTION_NONE.
|
||||
*/
|
||||
MetaKeyBindingAction
|
||||
guint
|
||||
meta_display_get_keybinding_action (MetaDisplay *display,
|
||||
unsigned int keycode,
|
||||
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);
|
||||
|
||||
if (binding)
|
||||
return meta_prefs_get_keybinding_action (binding->name);
|
||||
return (guint) meta_prefs_get_keybinding_action (binding->name);
|
||||
else
|
||||
return META_KEYBINDING_ACTION_NONE;
|
||||
}
|
||||
|
@ -127,19 +127,19 @@ void meta_display_end_grab_op (MetaDisplay *display,
|
||||
|
||||
MetaGrabOp meta_display_get_grab_op (MetaDisplay *display);
|
||||
|
||||
gboolean meta_display_add_keybinding (MetaDisplay *display,
|
||||
const char *name,
|
||||
GSettings *settings,
|
||||
MetaKeyBindingFlags flags,
|
||||
MetaKeyHandlerFunc handler,
|
||||
gpointer user_data,
|
||||
GDestroyNotify free_data);
|
||||
guint meta_display_add_keybinding (MetaDisplay *display,
|
||||
const char *name,
|
||||
GSettings *settings,
|
||||
MetaKeyBindingFlags flags,
|
||||
MetaKeyHandlerFunc handler,
|
||||
gpointer user_data,
|
||||
GDestroyNotify free_data);
|
||||
gboolean meta_display_remove_keybinding (MetaDisplay *display,
|
||||
const char *name);
|
||||
|
||||
MetaKeyBindingAction meta_display_get_keybinding_action (MetaDisplay *display,
|
||||
unsigned int keycode,
|
||||
unsigned long mask);
|
||||
guint meta_display_get_keybinding_action (MetaDisplay *display,
|
||||
unsigned int keycode,
|
||||
unsigned long mask);
|
||||
|
||||
/* meta_display_set_input_focus_window is like XSetInputFocus, except
|
||||
* that (a) it can't detect timestamps later than the current time,
|
||||
|
Loading…
Reference in New Issue
Block a user