Fixed process_tab_grab()

When there is custom handler installed for the tab releavant tab function
  we do not want to actually call it form inside of this function, only to
  ensure that the grab is not released. The handler will get called in the
  normal way in process_event(). Whoever installed the handler (and requested
  the grab) also has to ensure the grab is released.
This commit is contained in:
Tomas Frydrych 2009-02-03 17:30:49 +00:00
parent c1f3a5c67d
commit 1d38209520

View File

@ -2004,10 +2004,8 @@ process_tab_grab (MetaDisplay *display,
*/ */
if (!screen->tab_popup) if (!screen->tab_popup)
{ {
MetaKeyBinding *binding = NULL;
MetaKeyHandler *handler = NULL; MetaKeyHandler *handler = NULL;
const gchar *handler_name = NULL; const gchar *handler_name = NULL;
gint i;
switch (action) switch (action)
{ {
@ -2056,32 +2054,16 @@ process_tab_grab (MetaDisplay *display,
return TRUE; return TRUE;
} }
/*
* We do not want to actually call the handler, we just want to ensure
* that if a custom handler is installed, we do not release the grab here.
* The handler will get called as normal in the process_event() function.
*/
handler = find_handler (key_handlers, handler_name); handler = find_handler (key_handlers, handler_name);
i = display->n_key_bindings - 1; if (!handler || !handler->func || handler->func == handler->default_func)
while (i >= 0)
{
if (display->key_bindings[i].keysym == keysym &&
display->key_bindings[i].keycode == event->xkey.keycode &&
display->key_bindings[i].mask == display->grab_mask)
{
binding = &display->key_bindings[i];
break;
}
--i;
}
/*
* If we have no custom handler for this operation, we do nothing.
*/
if (!binding || !handler ||
!handler->func || handler->func == handler->default_func)
return FALSE; return FALSE;
(*handler->func) (display, screen, NULL, event, binding,
handler->user_data);
return TRUE; return TRUE;
} }