diff options
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r-- | sway/commands/move.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index de6b1b0a..c6dc0775 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -1,4 +1,5 @@ #define _XOPEN_SOURCE 500 +#include <ctype.h> #include <stdbool.h> #include <string.h> #include <strings.h> @@ -22,7 +23,7 @@ static const char *expected_syntax = "Expected 'move <left|right|up|down> <[px] px>' or " "'move [--no-auto-back-and-forth] <container|window> [to] workspace <name>' or " - "'move [--no-auto-back-and-forth] <container|window|workspace> [to] output <name|direction>' or " + "'move <container|window|workspace> [to] output <name|direction>' or " "'move <container|window> [to] mark <mark>'"; static struct sway_container *output_in_direction(const char *direction, @@ -64,7 +65,7 @@ static struct cmd_results *cmd_move_container(struct sway_container *current, return cmd_results_new(CMD_FAILURE, "move", "Can't move an empty workspace"); } - current = container_wrap_children(current); + current = workspace_wrap_children(current); } else if (current->type != C_CONTAINER && current->type != C_VIEW) { return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); @@ -124,7 +125,11 @@ static struct cmd_results *cmd_move_container(struct sway_container *current, return cmd_results_new(CMD_INVALID, "move", expected_syntax); } - ws_name = strdup(argv[3]); + if (!isdigit(argv[3][0])) { + return cmd_results_new(CMD_INVALID, "move", + "Invalid workspace number '%s'", argv[3]); + } + ws_name = join_args(argv + 3, argc - 3); ws = workspace_by_number(ws_name); } else { ws_name = join_args(argv + 2, argc - 2); @@ -231,7 +236,6 @@ static void workspace_move_to_output(struct sway_container *workspace, seat_get_focus_inactive(seat, output); container_add_child(output, workspace); - wl_signal_emit(&workspace->events.reparent, old_output); // If moving the last workspace from the old output, create a new workspace // on the old output @@ -245,7 +249,7 @@ static void workspace_move_to_output(struct sway_container *workspace, // Try to remove an empty workspace from the destination output. container_reap_empty_recursive(new_output_focus); - container_sort_workspaces(output); + output_sort_workspaces(output); seat_set_focus(seat, output); workspace_output_raise_priority(workspace, old_output, output); ipc_event_workspace(NULL, workspace, "move"); @@ -437,14 +441,14 @@ static struct cmd_results *move_to_scratchpad(struct sway_container *con) { if (con->type == C_WORKSPACE) { // Wrap the workspace's children in a container struct sway_container *workspace = con; - con = container_wrap_children(con); + con = workspace_wrap_children(con); workspace->layout = L_HORIZ; } // If the container is in a floating split container, // operate on the split container instead of the child. if (container_is_floating_or_child(con)) { - while (con->parent->layout != L_FLOATING) { + while (con->parent->type != C_WORKSPACE) { con = con->parent; } } |