fixes for new keybindings stuff/chroot/parsing

This commit is contained in:
Dana Jansens 2007-04-26 02:10:15 +00:00
parent b6d2529acb
commit 8c68c9ab0f
4 changed files with 28 additions and 14 deletions

View file

@ -892,6 +892,11 @@ ActionString actionstrings[] =
action_growtoedge, action_growtoedge,
setup_action_growtoedge_east setup_action_growtoedge_east
}, },
{
"breakchroot",
action_break_chroot,
NULL
},
{ {
NULL, NULL,
NULL, NULL,
@ -1899,3 +1904,9 @@ void action_unshow_desktop(union ActionData *data)
{ {
screen_show_desktop(FALSE); screen_show_desktop(FALSE);
} }
void action_break_chroot(union ActionData *data)
{
/* break out of one chroot */
keyboard_reset_chains(1);
}

View file

@ -341,5 +341,7 @@ void action_toggle_show_desktop(union ActionData *data);
void action_show_desktop(union ActionData *data); void action_show_desktop(union ActionData *data);
/* Any */ /* Any */
void action_unshow_desktop(union ActionData *data); void action_unshow_desktop(union ActionData *data);
/* Any */
void action_break_chroot(union ActionData *data);
#endif #endif

View file

@ -278,6 +278,7 @@ static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
if (!parse_attr_string("key", node, &key)) if (!parse_attr_string("key", node, &key))
return; return;
parse_attr_bool("chroot", node, &is_chroot); parse_attr_bool("chroot", node, &is_chroot);
keylist = g_list_append(keylist, key); keylist = g_list_append(keylist, key);
@ -304,9 +305,6 @@ static void parse_key(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
g_free(key); g_free(key);
keylist = g_list_delete_link(keylist, g_list_last(keylist)); keylist = g_list_delete_link(keylist, g_list_last(keylist));
/* go to next sibling */
if (node->next) parse_key(i, doc, node->next, keylist);
} }
static void parse_keyboard(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node, static void parse_keyboard(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
@ -325,7 +323,10 @@ static void parse_keyboard(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
} }
if ((n = parse_find_node("keybind", node->children))) if ((n = parse_find_node("keybind", node->children)))
parse_key(i, doc, n, NULL); while (n) {
parse_key(i, doc, n, NULL);
n = parse_find_node("keybind", n->next);
}
} }
/* /*

View file

@ -133,16 +133,16 @@ KeyBindingTree *tree_find(KeyBindingTree *search, gboolean *conflict)
gboolean tree_chroot(KeyBindingTree *tree, GList *keylist) gboolean tree_chroot(KeyBindingTree *tree, GList *keylist)
{ {
if (keylist == NULL) { guint key, state;
tree->chroot = TRUE; if (translate_key(keylist->data, &state, &key)) {
return TRUE; while (tree != NULL && !(tree->state == state && tree->key == key))
} else { tree = tree->next_sibling;
guint key, state; if (tree != NULL) {
if (translate_key(keylist->data, &state, &key)) { if (keylist->next == NULL) {
while (tree != NULL && !(tree->state == state && tree->key == key)) tree->chroot = TRUE;
tree = tree->next_sibling; return TRUE;
if (tree != NULL) } else
return tree_chroot(tree, keylist->next); return tree_chroot(tree->first_child, keylist->next);
} }
} }
return FALSE; return FALSE;