Parse multiple keys in one keybind
This commit is contained in:
parent
36a437a702
commit
3ff4162034
1 changed files with 25 additions and 20 deletions
|
@ -389,39 +389,44 @@ static void parse_per_app_settings(xmlNodePtr node, gpointer d)
|
||||||
|
|
||||||
static void parse_key(xmlNodePtr node, GList *keylist)
|
static void parse_key(xmlNodePtr node, GList *keylist)
|
||||||
{
|
{
|
||||||
gchar *key;
|
gchar *keystring, **keys, **key;
|
||||||
xmlNodePtr n;
|
xmlNodePtr n;
|
||||||
gboolean is_chroot = FALSE;
|
gboolean is_chroot = FALSE;
|
||||||
|
|
||||||
if (!obt_xml_attr_string(node, "key", &key))
|
if (!obt_xml_attr_string(node, "key", &keystring))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
obt_xml_attr_bool(node, "chroot", &is_chroot);
|
obt_xml_attr_bool(node, "chroot", &is_chroot);
|
||||||
|
|
||||||
keylist = g_list_append(keylist, key);
|
keys = g_strsplit(keystring, " ", 0);
|
||||||
|
for (key = keys; *key; ++key) {
|
||||||
|
keylist = g_list_append(keylist, *key);
|
||||||
|
|
||||||
if ((n = obt_xml_find_node(node->children, "keybind"))) {
|
if ((n = obt_xml_find_node(node->children, "keybind"))) {
|
||||||
while (n) {
|
while (n) {
|
||||||
parse_key(n, keylist);
|
parse_key(n, keylist);
|
||||||
n = obt_xml_find_node(n->next, "keybind");
|
n = obt_xml_find_node(n->next, "keybind");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else if ((n = obt_xml_find_node(node->children, "action"))) {
|
||||||
else if ((n = obt_xml_find_node(node->children, "action"))) {
|
while (n) {
|
||||||
while (n) {
|
ObActionsAct *action;
|
||||||
ObActionsAct *action;
|
|
||||||
|
|
||||||
action = actions_parse(n);
|
action = actions_parse(n);
|
||||||
if (action)
|
if (action)
|
||||||
keyboard_bind(keylist, action);
|
keyboard_bind(keylist, action);
|
||||||
n = obt_xml_find_node(n->next, "action");
|
n = obt_xml_find_node(n->next, "action");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (is_chroot)
|
||||||
|
keyboard_chroot(keylist);
|
||||||
|
keylist = g_list_delete_link(keylist, g_list_last(keylist));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_chroot)
|
g_strfreev(keys);
|
||||||
keyboard_chroot(keylist);
|
g_free(keystring);
|
||||||
|
|
||||||
g_free(key);
|
|
||||||
keylist = g_list_delete_link(keylist, g_list_last(keylist));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void parse_keyboard(xmlNodePtr node, gpointer d)
|
static void parse_keyboard(xmlNodePtr node, gpointer d)
|
||||||
|
|
Loading…
Reference in a new issue