mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
Implemented meta_keybindings_set_custom_handler().
This commit is contained in:
parent
e25282088b
commit
096e3dee8f
@ -3368,3 +3368,40 @@ handle_run_terminal (MetaDisplay *display,
|
|||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_keybindings_set_custom_handler (const gchar *name,
|
||||||
|
MetaKeyHandlerFunc handler,
|
||||||
|
gpointer user_data,
|
||||||
|
MetaKeyHandlerDataFreeFunc free_data)
|
||||||
|
{
|
||||||
|
MetaKeyHandler *key_handler = NULL;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME -- the bindings should be in a hashtable or at least sorted somehow.
|
||||||
|
*/
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (key_handlers); ++i)
|
||||||
|
{
|
||||||
|
if (!g_strcmp0 (key_handlers[i].name, name))
|
||||||
|
{
|
||||||
|
key_handler = (MetaKeyHandler*)&key_handlers[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!key_handler)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (key_handler->user_data_free_func && key_handler->user_data)
|
||||||
|
{
|
||||||
|
key_handler->user_data_free_func (key_handler->user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
key_handler->func = handler;
|
||||||
|
key_handler->user_data = user_data;
|
||||||
|
key_handler->user_data_free_func = free_data;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -52,8 +52,7 @@ struct _MetaKeyBinding
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void
|
gboolean meta_keybindings_set_custom_handler (const gchar *name,
|
||||||
meta_keybindings_set_custom_hander (const gchar *name,
|
|
||||||
MetaKeyHandlerFunc handler,
|
MetaKeyHandlerFunc handler,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
MetaKeyHandlerDataFreeFunc free_data);
|
MetaKeyHandlerDataFreeFunc free_data);
|
||||||
|
Loading…
Reference in New Issue
Block a user