src/action.c: Provide generic parsing of XML action arguments

.. and use it within src/config/rcxml.c and src/menu/menu.c.

This fixes being unable to use the `direction` argument in menu entries.

Reported-by: mahk via IRC
This commit is contained in:
Consolatis 2022-12-10 15:28:25 +01:00 committed by Johan Malm
parent 7ad5490ff0
commit 7cc80b7a99
4 changed files with 32 additions and 33 deletions

View file

@ -283,19 +283,8 @@ fill_item(char *nodename, char *content)
} else if (!current_item_action) {
wlr_log(WLR_ERROR, "expect <action name=\"\"> element first. "
"nodename: '%s' content: '%s'", nodename, content);
} else if (!strcmp(nodename, "command.action")) {
/* Execute */
action_arg_add_str(current_item_action, NULL, content);
} else if (!strcmp(nodename, "execute.action")) {
/*
* <action name="Execute"><execute>foo</execute></action>
* is deprecated, but we support it anyway for backward
* compatibility with old openbox-menu generators
*/
action_arg_add_str(current_item_action, NULL, content);
} else if (!strcmp(nodename, "to.action")) {
/* GoToDesktop, SendToDesktop */
action_arg_add_str(current_item_action, NULL, content);
} else {
action_arg_from_xml_node(current_item_action, nodename, content);
}
}