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:
parent
9dee164790
commit
6e543fbcfd
@ -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;
|
||||
|
||||
(* handler->func) (display, screen,
|
||||
bindings[i].handler->flags & BINDING_PER_WINDOW? window: NULL,
|
||||
event,
|
||||
&bindings[i],
|
||||
handler->user_data);
|
||||
if (handler->func)
|
||||
(* handler->func) (display, screen,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user