mirror of
https://github.com/swaywm/sway
synced 2024-11-18 14:53:52 +01:00
Fix container move when workspace is focused
Fixes #819. If workspace is focused and command 'move container to workspace/output' is issued, workspace child containers are wrapped in a new container and moved according to command.
This commit is contained in:
parent
e8ca63702e
commit
61781bbef0
@ -1032,7 +1032,9 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
|
|||||||
return error;
|
return error;
|
||||||
} else if ( strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) {
|
} else if ( strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) {
|
||||||
// move container to workspace x
|
// move container to workspace x
|
||||||
if (view->type != C_CONTAINER && view->type != C_VIEW) {
|
if (view->type == C_WORKSPACE) {
|
||||||
|
view = new_container(view, view->layout);
|
||||||
|
} if (view->type != C_CONTAINER && view->type != C_VIEW) {
|
||||||
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
|
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1055,19 +1057,21 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
|
|||||||
swayc_t *output = NULL;
|
swayc_t *output = NULL;
|
||||||
struct wlc_point abs_pos;
|
struct wlc_point abs_pos;
|
||||||
get_absolute_center_position(view, &abs_pos);
|
get_absolute_center_position(view, &abs_pos);
|
||||||
if (view->type != C_CONTAINER && view->type != C_VIEW) {
|
if (view->type == C_WORKSPACE) {
|
||||||
|
view = new_container(view, view->layout);
|
||||||
|
} else if (view->type != C_CONTAINER && view->type != C_VIEW) {
|
||||||
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
|
return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
|
||||||
} else if (!(output = output_by_name(argv[3], &abs_pos))) {
|
} else if (!(output = output_by_name(argv[3], &abs_pos))) {
|
||||||
return cmd_results_new(CMD_FAILURE, "move",
|
return cmd_results_new(CMD_FAILURE, "move",
|
||||||
"Can't find output with name/direction '%s' @ (%i,%i)", argv[3], abs_pos.x, abs_pos.y);
|
"Can't find output with name/direction '%s' @ (%i,%i)", argv[3], abs_pos.x, abs_pos.y);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
swayc_t *container = get_focused_container(output);
|
swayc_t *container = get_focused_container(output);
|
||||||
if (container->is_floating) {
|
if (container->is_floating) {
|
||||||
move_container_to(view, container->parent);
|
move_container_to(view, container->parent);
|
||||||
} else {
|
} else {
|
||||||
move_container_to(view, container);
|
move_container_to(view, container);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return cmd_results_new(CMD_INVALID, "move", expected_syntax);
|
return cmd_results_new(CMD_INVALID, "move", expected_syntax);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user