summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-08-07 12:04:08 -0400
committerLibravatar GitHub <noreply@github.com>2016-08-07 12:04:08 -0400
commitb8642ce681d5afd547f93b9b43949be7410265b9 (patch)
tree829eca95806f98bf1f82dc950e1eb8ec2f1ef86c
parentMerge pull request #842 from thejan2009/bug/move-workspace-sort-output (diff)
parentFix container move when workspace is focused (diff)
downloadsway-b8642ce681d5afd547f93b9b43949be7410265b9.tar.gz
sway-b8642ce681d5afd547f93b9b43949be7410265b9.tar.zst
sway-b8642ce681d5afd547f93b9b43949be7410265b9.zip
Merge pull request #843 from thejan2009/bug/move-container-819
Fix container move when workspace is focused
-rw-r--r--sway/commands.c20
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) {
1032 return error; 1032 return error;
1033 } else if ( strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) { 1033 } else if ( strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "workspace") == 0) {
1034 // move container to workspace x 1034 // move container to workspace x
1035 if (view->type != C_CONTAINER && view->type != C_VIEW) { 1035 if (view->type == C_WORKSPACE) {
1036 view = new_container(view, view->layout);
1037 } if (view->type != C_CONTAINER && view->type != C_VIEW) {
1036 return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); 1038 return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
1037 } 1039 }
1038 1040
@@ -1055,18 +1057,20 @@ static struct cmd_results *cmd_move(int argc, char **argv) {
1055 swayc_t *output = NULL; 1057 swayc_t *output = NULL;
1056 struct wlc_point abs_pos; 1058 struct wlc_point abs_pos;
1057 get_absolute_center_position(view, &abs_pos); 1059 get_absolute_center_position(view, &abs_pos);
1058 if (view->type != C_CONTAINER && view->type != C_VIEW) { 1060 if (view->type == C_WORKSPACE) {
1061 view = new_container(view, view->layout);
1062 } else if (view->type != C_CONTAINER && view->type != C_VIEW) {
1059 return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); 1063 return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views.");
1060 } else if (!(output = output_by_name(argv[3], &abs_pos))) { 1064 } else if (!(output = output_by_name(argv[3], &abs_pos))) {
1061 return cmd_results_new(CMD_FAILURE, "move", 1065 return cmd_results_new(CMD_FAILURE, "move",
1062 "Can't find output with name/direction '%s' @ (%i,%i)", argv[3], abs_pos.x, abs_pos.y); 1066 "Can't find output with name/direction '%s' @ (%i,%i)", argv[3], abs_pos.x, abs_pos.y);
1067 }
1068
1069 swayc_t *container = get_focused_container(output);
1070 if (container->is_floating) {
1071 move_container_to(view, container->parent);
1063 } else { 1072 } else {
1064 swayc_t *container = get_focused_container(output); 1073 move_container_to(view, container);
1065 if (container->is_floating) {
1066 move_container_to(view, container->parent);
1067 } else {
1068 move_container_to(view, container);
1069 }
1070 } 1074 }
1071 } else { 1075 } else {
1072 return cmd_results_new(CMD_INVALID, "move", expected_syntax); 1076 return cmd_results_new(CMD_INVALID, "move", expected_syntax);