mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
rcxml.c: combine common code in fill_{key,mouse}bind()
This commit is contained in:
parent
e9c3080f76
commit
cce2fffa1d
1 changed files with 22 additions and 20 deletions
|
|
@ -45,6 +45,24 @@ enum font_place {
|
|||
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)
|
||||
{
|
||||
|
|
@ -73,18 +91,8 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,14 +141,8 @@ fill_mousebind(char *nodename, char *content)
|
|||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue