static void load_default_key_bindings(void);
static void load_default_mouse_bindings(void);
+static void
+fill_common(char *nodename, char *content, struct action *action)
+{
+ if (!strcmp(nodename, "command.action")) {
+ /* Execute */
+ action_arg_add_str(action, NULL, content);
+ } else if (!strcmp(nodename, "direction.action")) {
+ /* MoveToEdge, SnapToEdge */
+ action_arg_add_str(action, NULL, content);
+ } else if (!strcmp(nodename, "menu.action")) {
+ /* ShowMenu */
+ action_arg_add_str(action, NULL, content);
+ } else if (!strcmp(nodename, "to.action")) {
+ /* GoToDesktop, SendToDesktop */
+ action_arg_add_str(action, NULL, content);
+ }
+}
+
static void
fill_keybind(char *nodename, char *content)
{
} else if (!current_keybind_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_keybind_action, NULL, content);
- } else if (!strcmp(nodename, "direction.action")) {
- /* MoveToEdge, SnapToEdge */
- action_arg_add_str(current_keybind_action, NULL, content);
- } else if (!strcmp(nodename, "menu.action")) {
- /* ShowMenu */
- action_arg_add_str(current_keybind_action, NULL, content);
- } else if (!strcmp(nodename, "to.action")) {
- /* GoToDesktop, SendToDesktop */
- action_arg_add_str(current_keybind_action, NULL, content);
+ } else {
+ fill_common(nodename, content, current_keybind_action);
}
}
} else if (!current_mousebind_action) {
wlr_log(WLR_ERROR, "expect <action name=\"\"> element first. "
"nodename: '%s' content: '%s'", nodename, content);
- } else if (!strcmp(nodename, "command.action")) {
- action_arg_add_str(current_mousebind_action, NULL, content);
- } else if (!strcmp(nodename, "direction.action")) {
- action_arg_add_str(current_mousebind_action, NULL, content);
- } else if (!strcmp(nodename, "menu.action")) {
- action_arg_add_str(current_mousebind_action, NULL, content);
- } else if (!strcmp(nodename, "to.action")) {
- action_arg_add_str(current_mousebind_action, NULL, content);
+ } else {
+ fill_common(nodename, content, current_mousebind_action);
}
}