Store the default keybinding handler alongside the custom one.

This allows us to fall back onto it if the custom handler removes itself.
This commit is contained in:
Tomas Frydrych 2009-02-03 13:20:51 +00:00
parent 9dee164790
commit 6e543fbcfd
2 changed files with 18 additions and 7 deletions

View File

@ -105,10 +105,10 @@ static void regrab_key_bindings (MetaDisplay *display);
#define keybind(name, handler, param, flags, stroke, description) \
{ #name, handler, param, flags, NULL, NULL },
{ #name, handler, handler, param, flags, NULL, NULL },
static MetaKeyHandler key_handlers[] = {
#include "all-keybindings.h"
{ NULL, NULL, 0, 0, NULL, NULL }
{ NULL, NULL, NULL, 0, 0, NULL, NULL }
};
#undef keybind
@ -1196,11 +1196,21 @@ process_event (MetaKeyBinding *bindings,
*/
display->allow_terminal_deactivation = TRUE;
if (handler->func)
(* handler->func) (display, screen,
bindings[i].handler->flags & BINDING_PER_WINDOW? window: NULL,
bindings[i].handler->flags & BINDING_PER_WINDOW ?
window: NULL,
event,
&bindings[i],
handler->user_data);
else
(* handler->default_func) (display, screen,
bindings[i].handler->flags & BINDING_PER_WINDOW ?
window: NULL,
event,
&bindings[i],
NULL);
return TRUE;
}

View File

@ -36,6 +36,7 @@ typedef struct
{
const char *name;
MetaKeyHandlerFunc func;
MetaKeyHandlerFunc default_func;
gint data, flags;
gpointer user_data;
MetaKeyHandlerDataFreeFunc user_data_free_func;