diff --git a/src/core/keybindings.c b/src/core/keybindings.c index a5a60e8cde30e395968e7d511d599c5a1e56e731..b86272541bd21782b14b63ea10df783f98388d93 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1933,6 +1933,12 @@ invoke_handler (MetaDisplay *display, NULL); } +static gboolean +meta_key_binding_has_handler_func (MetaKeyBinding *binding) +{ + return (!!binding->handler->func || !!binding->handler->default_func); +} + static gboolean process_event (MetaDisplay *display, MetaWindow *window, @@ -1955,6 +1961,12 @@ process_event (MetaDisplay *display, (!window && binding->flags & META_KEY_BINDING_PER_WINDOW)) goto not_found; + if (binding->handler == NULL) + meta_bug ("Binding %s has no handler\n", binding->name); + + if (!meta_key_binding_has_handler_func (binding)) + goto not_found; + if (display->focus_window && !(binding->handler->flags & META_KEY_BINDING_NON_MASKABLE)) { @@ -1980,12 +1992,9 @@ process_event (MetaDisplay *display, return TRUE; } - if (binding->handler == NULL) - meta_bug ("Binding %s has no handler\n", binding->name); - else - meta_topic (META_DEBUG_KEYBINDINGS, - "Running handler for %s\n", - binding->name); + meta_topic (META_DEBUG_KEYBINDINGS, + "Running handler for %s\n", + binding->name); /* Global keybindings count as a let-the-terminal-lose-focus * due to new window mapping until the user starts