diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-08-07 12:04:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-07 12:04:08 -0400 |
commit | b8642ce681d5afd547f93b9b43949be7410265b9 (patch) | |
tree | 829eca95806f98bf1f82dc950e1eb8ec2f1ef86c /sway | |
parent | 9e37a13d7b8688039184f8d7d9c67882f2e8e6c7 (diff) | |
parent | 61781bbef0f75e935a6d71f691de8f63a1508e16 (diff) |
Merge pull request #843 from thejan2009/bug/move-container-819
Fix container move when workspace is focused
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sway/commands.c b/sway/commands.c index 172f9f34..54139593 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -1032,7 +1032,9 @@ static struct cmd_results *cmd_move(int argc, char **argv) { return error; } else if ( strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) { // 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."); } @@ -1055,18 +1057,20 @@ static struct cmd_results *cmd_move(int argc, char **argv) { swayc_t *output = NULL; struct wlc_point 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."); } else if (!(output = output_by_name(argv[3], &abs_pos))) { 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); + } + + swayc_t *container = get_focused_container(output); + if (container->is_floating) { + move_container_to(view, container->parent); } else { - swayc_t *container = get_focused_container(output); - if (container->is_floating) { - move_container_to(view, container->parent); - } else { - move_container_to(view, container); - } + move_container_to(view, container); } } else { return cmd_results_new(CMD_INVALID, "move", expected_syntax); |