mirror of
https://github.com/labwc/labwc.git
synced 2026-04-12 08:21:13 -04:00
add wrap argument
This commit is contained in:
parent
7a69fffe44
commit
f9017b389b
2 changed files with 13 additions and 3 deletions
|
|
@ -70,11 +70,14 @@ Actions are used in menus and keyboard/mouse bindings.
|
||||||
|
|
||||||
*direction* [left|up|right|down] Direction in which to shrink.
|
*direction* [left|up|right|down] Direction in which to shrink.
|
||||||
|
|
||||||
*<action name="DirectionalTargetWindow" direction="value" />*
|
*<action name="DirectionalTargetWindow" direction="value" wrap="value" />*
|
||||||
Move focus to closest window in given direction.
|
Move focus to closest window in given direction.
|
||||||
|
|
||||||
*direction* [left|up|right|down] Direction in which to move.
|
*direction* [left|up|right|down] Direction in which to move.
|
||||||
|
|
||||||
|
*wrap* [yes|no] Wrap around from right-to-left or top-to-bottom,
|
||||||
|
and vice versa. Default no.
|
||||||
|
|
||||||
*<action name="MoveTo" x="" y="" />*
|
*<action name="MoveTo" x="" y="" />*
|
||||||
Move to position (x, y).
|
Move to position (x, y).
|
||||||
|
|
||||||
|
|
|
||||||
11
src/action.c
11
src/action.c
|
|
@ -300,6 +300,12 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ACTION_TYPE_DIRECTIONAL_TARGET_WINDOW:
|
||||||
|
if (!strcasecmp(argument, "wrap")) {
|
||||||
|
action_arg_add_bool(action, argument, parse_bool(content, false));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
/* Falls through */
|
||||||
case ACTION_TYPE_MOVE_TO_EDGE:
|
case ACTION_TYPE_MOVE_TO_EDGE:
|
||||||
if (!strcasecmp(argument, "snapWindows")) {
|
if (!strcasecmp(argument, "snapWindows")) {
|
||||||
action_arg_add_bool(action, argument, parse_bool(content, true));
|
action_arg_add_bool(action, argument, parse_bool(content, true));
|
||||||
|
|
@ -308,7 +314,6 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
/* Falls through */
|
/* Falls through */
|
||||||
case ACTION_TYPE_SNAP_TO_EDGE:
|
case ACTION_TYPE_SNAP_TO_EDGE:
|
||||||
case ACTION_TYPE_GROW_TO_EDGE:
|
case ACTION_TYPE_GROW_TO_EDGE:
|
||||||
case ACTION_TYPE_DIRECTIONAL_TARGET_WINDOW:
|
|
||||||
case ACTION_TYPE_SHRINK_TO_EDGE:
|
case ACTION_TYPE_SHRINK_TO_EDGE:
|
||||||
if (!strcmp(argument, "direction")) {
|
if (!strcmp(argument, "direction")) {
|
||||||
enum view_edge edge = view_edge_parse(content);
|
enum view_edge edge = view_edge_parse(content);
|
||||||
|
|
@ -845,9 +850,11 @@ actions_run(struct view *activator, struct server *server,
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_DIRECTIONAL_TARGET_WINDOW:
|
case ACTION_TYPE_DIRECTIONAL_TARGET_WINDOW:
|
||||||
if (view) {
|
if (view) {
|
||||||
|
/* Config parsing makes sure that direction is a valid direction */
|
||||||
enum view_edge direction = action_get_int(action, "direction", 0);
|
enum view_edge direction = action_get_int(action, "direction", 0);
|
||||||
|
bool wrap = action_get_bool(action, "wrap", false);
|
||||||
struct view *closest_view = directional_target_window(view, server,
|
struct view *closest_view = directional_target_window(view, server,
|
||||||
direction, /*wrap*/ true);
|
direction, wrap);
|
||||||
if (closest_view) {
|
if (closest_view) {
|
||||||
desktop_focus_view(closest_view, /*raise*/ true);
|
desktop_focus_view(closest_view, /*raise*/ true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue