Add meta_key_binding_is_reversed()

MetaKeyBinding can be marked as being reversed
(META_KEY_BINDING_IS_REVERSED), but MetaKeyHandlerFunc callbacks
cannot check whether this flag was set or not on the MetaKeyBinding
which triggered the callback.

https://bugzilla.gnome.org/show_bug.cgi?id=732295
This commit is contained in:
Christophe Fergeau 2014-05-29 20:38:13 +02:00
parent 6acf7b06f4
commit c5c6b2257f
2 changed files with 10 additions and 2 deletions

View File

@ -101,6 +101,12 @@ meta_key_binding_get_modifiers (MetaKeyBinding *binding)
return binding->modifiers; return binding->modifiers;
} }
gboolean
meta_key_binding_is_reversed (MetaKeyBinding *binding)
{
return (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0;
}
guint guint
meta_key_binding_get_mask (MetaKeyBinding *binding) meta_key_binding_get_mask (MetaKeyBinding *binding)
{ {
@ -2970,7 +2976,7 @@ handle_switch (MetaDisplay *display,
MetaKeyBinding *binding, MetaKeyBinding *binding,
gpointer dummy) gpointer dummy)
{ {
gint backwards = (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0; gboolean backwards = meta_key_binding_is_reversed (binding);
do_choose_window (display, screen, event_window, event, binding, backwards); do_choose_window (display, screen, event_window, event, binding, backwards);
} }
@ -2982,7 +2988,7 @@ handle_cycle (MetaDisplay *display,
MetaKeyBinding *binding, MetaKeyBinding *binding,
gpointer dummy) gpointer dummy)
{ {
gint backwards = (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0; gboolean backwards = meta_key_binding_is_reversed (binding);
do_choose_window (display, screen, event_window, event, binding, backwards); do_choose_window (display, screen, event_window, event, binding, backwards);
} }

View File

@ -27,6 +27,8 @@ const char *meta_key_binding_get_name (MetaKeyBinding *binding);
MetaVirtualModifier meta_key_binding_get_modifiers (MetaKeyBinding *binding); MetaVirtualModifier meta_key_binding_get_modifiers (MetaKeyBinding *binding);
guint meta_key_binding_get_mask (MetaKeyBinding *binding); guint meta_key_binding_get_mask (MetaKeyBinding *binding);
gboolean meta_key_binding_is_builtin (MetaKeyBinding *binding); gboolean meta_key_binding_is_builtin (MetaKeyBinding *binding);
gboolean meta_key_binding_is_reversed (MetaKeyBinding *binding);
gboolean meta_keybindings_set_custom_handler (const gchar *name, gboolean meta_keybindings_set_custom_handler (const gchar *name,
MetaKeyHandlerFunc handler, MetaKeyHandlerFunc handler,