From c5c6b2257f6725e8ef100fa810050c714f4b4ba1 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 29 May 2014 20:38:13 +0200 Subject: [PATCH] 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 --- src/core/keybindings.c | 10 ++++++++-- src/meta/keybindings.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 6c7463579..089b582fe 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -101,6 +101,12 @@ meta_key_binding_get_modifiers (MetaKeyBinding *binding) return binding->modifiers; } +gboolean +meta_key_binding_is_reversed (MetaKeyBinding *binding) +{ + return (binding->handler->flags & META_KEY_BINDING_IS_REVERSED) != 0; +} + guint meta_key_binding_get_mask (MetaKeyBinding *binding) { @@ -2970,7 +2976,7 @@ handle_switch (MetaDisplay *display, MetaKeyBinding *binding, 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); } @@ -2982,7 +2988,7 @@ handle_cycle (MetaDisplay *display, MetaKeyBinding *binding, 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); } diff --git a/src/meta/keybindings.h b/src/meta/keybindings.h index 4eeb27e81..679bd206a 100644 --- a/src/meta/keybindings.h +++ b/src/meta/keybindings.h @@ -27,6 +27,8 @@ const char *meta_key_binding_get_name (MetaKeyBinding *binding); MetaVirtualModifier meta_key_binding_get_modifiers (MetaKeyBinding *binding); guint meta_key_binding_get_mask (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, MetaKeyHandlerFunc handler,