mirror of
https://github.com/labwc/labwc.git
synced 2026-02-25 01:40:28 -05:00
action: allow SnapToEdge to combine two cardinal directions
This patch adds `combine` argument to (Toggle)SnapToEdge actions. This allows to snap a window to e.g. up-left by running two actions: - `<action name="SnapToEdge" direction="left" combine="yes" />` - `<action name="SnapToEdge" direction="up" combine="yes" />` Then running `<action name="SnapToEdge" direction="down" combine="yes" />` snaps it to left again. This behavior is almost the same as KWin, except that snapping a up-right-tiled window to right doesn't move it to the right-adjacent output, but makes it right-tiled first.
This commit is contained in:
parent
af6a0df231
commit
2ac48116e1
5 changed files with 68 additions and 26 deletions
22
src/action.c
22
src/action.c
|
|
@ -337,11 +337,6 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
}
|
||||
break;
|
||||
case ACTION_TYPE_MOVE_TO_EDGE:
|
||||
if (!strcasecmp(argument, "snapWindows")) {
|
||||
action_arg_add_bool(action, argument, parse_bool(content, true));
|
||||
goto cleanup;
|
||||
}
|
||||
/* Falls through */
|
||||
case ACTION_TYPE_TOGGLE_SNAP_TO_EDGE:
|
||||
case ACTION_TYPE_SNAP_TO_EDGE:
|
||||
case ACTION_TYPE_GROW_TO_EDGE:
|
||||
|
|
@ -358,6 +353,17 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
}
|
||||
goto cleanup;
|
||||
}
|
||||
if (action->type == ACTION_TYPE_MOVE_TO_EDGE
|
||||
&& !strcasecmp(argument, "snapWindows")) {
|
||||
action_arg_add_bool(action, argument, parse_bool(content, true));
|
||||
goto cleanup;
|
||||
}
|
||||
if ((action->type == ACTION_TYPE_SNAP_TO_EDGE
|
||||
|| action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE)
|
||||
&& !strcasecmp(argument, "combine")) {
|
||||
action_arg_add_bool(action, argument, parse_bool(content, false));
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_SHOW_MENU:
|
||||
if (!strcmp(argument, "menu")) {
|
||||
|
|
@ -1031,9 +1037,9 @@ run_action(struct view *view, struct server *server, struct action *action,
|
|||
view_apply_natural_geometry(view);
|
||||
break;
|
||||
}
|
||||
view_snap_to_edge(view, edge,
|
||||
/*across_outputs*/ true,
|
||||
/*store_natural_geometry*/ true);
|
||||
bool combine = action_get_bool(action, "combine", false);
|
||||
view_snap_to_edge(view, edge, /*across_outputs*/ true,
|
||||
combine, /*store_natural_geometry*/ true);
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_GROW_TO_EDGE:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue