diff options
author | Nicolas Cornu <nicolac76@yahoo.fr> | 2016-10-11 01:49:17 +0200 |
---|---|---|
committer | Nicolas Cornu <nicolac76@yahoo.fr> | 2016-10-11 01:51:55 +0200 |
commit | 5384d3effee0a6b41b99ca4cbad471d1b0dcbc20 (patch) | |
tree | 5f80bbe3775f0e405895ab973c62f8bbd8ea1bf8 | |
parent | Merge pull request #942 from thejan2009/bugfix-931 (diff) | |
download | sway-5384d3effee0a6b41b99ca4cbad471d1b0dcbc20.tar.gz sway-5384d3effee0a6b41b99ca4cbad471d1b0dcbc20.tar.zst sway-5384d3effee0a6b41b99ca4cbad471d1b0dcbc20.zip |
Can't move an empty workspace
-rw-r--r-- | sway/commands/move.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index 5b97897a..48e9d562 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -34,6 +34,9 @@ struct cmd_results *cmd_move(int argc, char **argv) { | |||
34 | } else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) { | 34 | } else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) { |
35 | // move container to workspace x | 35 | // move container to workspace x |
36 | if (view->type == C_WORKSPACE) { | 36 | if (view->type == C_WORKSPACE) { |
37 | if (!view->children || view->children->length == 0) { | ||
38 | return cmd_results_new(CMD_FAILURE, "move", "Cannot move an empty workspace"); | ||
39 | } | ||
37 | view = new_container(view, view->layout); | 40 | view = new_container(view, view->layout); |
38 | } if (view->type != C_CONTAINER && view->type != C_VIEW) { | 41 | } if (view->type != C_CONTAINER && view->type != C_VIEW) { |
39 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); | 42 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); |
@@ -59,6 +62,9 @@ struct cmd_results *cmd_move(int argc, char **argv) { | |||
59 | struct wlc_point abs_pos; | 62 | struct wlc_point abs_pos; |
60 | get_absolute_center_position(view, &abs_pos); | 63 | get_absolute_center_position(view, &abs_pos); |
61 | if (view->type == C_WORKSPACE) { | 64 | if (view->type == C_WORKSPACE) { |
65 | if (!view->children || view->children->length == 0) { | ||
66 | return cmd_results_new(CMD_FAILURE, "move", "Cannot move an empty workspace"); | ||
67 | } | ||
62 | view = new_container(view, view->layout); | 68 | view = new_container(view, view->layout); |
63 | } else if (view->type != C_CONTAINER && view->type != C_VIEW) { | 69 | } else if (view->type != C_CONTAINER && view->type != C_VIEW) { |
64 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); | 70 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); |