mirror of
https://github.com/labwc/labwc.git
synced 2026-02-21 01:40:26 -05:00
view: refactor view_edge_parse()
This commit is contained in:
parent
03004cf44b
commit
4b0ac0234c
4 changed files with 25 additions and 16 deletions
14
src/action.c
14
src/action.c
|
|
@ -342,11 +342,10 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
case ACTION_TYPE_GROW_TO_EDGE:
|
||||
case ACTION_TYPE_SHRINK_TO_EDGE:
|
||||
if (!strcmp(argument, "direction")) {
|
||||
enum view_edge edge = view_edge_parse(content);
|
||||
bool allow_center = action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
|
||||
|| action->type == ACTION_TYPE_SNAP_TO_EDGE;
|
||||
if ((edge == VIEW_EDGE_CENTER && !allow_center)
|
||||
|| edge == VIEW_EDGE_INVALID || edge == VIEW_EDGE_ALL) {
|
||||
bool tiled = (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
|
||||
|| action->type == ACTION_TYPE_SNAP_TO_EDGE);
|
||||
enum view_edge edge = view_edge_parse(content, tiled, /*any*/ false);
|
||||
if (edge == VIEW_EDGE_INVALID) {
|
||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||
action_names[action->type], argument, content);
|
||||
} else {
|
||||
|
|
@ -453,8 +452,9 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
goto cleanup;
|
||||
}
|
||||
if (!strcmp(argument, "direction")) {
|
||||
enum view_edge edge = view_edge_parse(content);
|
||||
if (edge == VIEW_EDGE_CENTER || edge == VIEW_EDGE_ALL) {
|
||||
enum view_edge edge = view_edge_parse(content,
|
||||
/*tiled*/ false, /*any*/ false);
|
||||
if (edge == VIEW_EDGE_INVALID) {
|
||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||
action_names[action->type], argument, content);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue