mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
Implemented meta_keybindings_set_custom_handler().
This commit is contained in:
parent
e25282088b
commit
096e3dee8f
@ -3127,9 +3127,9 @@ handle_toggle_on_all_workspaces (MetaDisplay *display,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
handle_move_to_workspace (MetaDisplay *display,
|
handle_move_to_workspace (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
@ -3314,9 +3314,9 @@ handle_workspace_switch (MetaDisplay *display,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
handle_set_spew_mark (MetaDisplay *display,
|
handle_set_spew_mark (MetaDisplay *display,
|
||||||
MetaScreen *screen,
|
MetaScreen *screen,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
XEvent *event,
|
XEvent *event,
|
||||||
MetaKeyBinding *binding,
|
MetaKeyBinding *binding,
|
||||||
gpointer dummy)
|
gpointer dummy)
|
||||||
{
|
{
|
||||||
@ -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,9 +52,8 @@ 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);
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user