diff options
-rw-r--r-- | sway/commands/move.c | 21 | ||||
-rw-r--r-- | sway/tree/container.c | 3 |
2 files changed, 14 insertions, 10 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index 5779b431..99215ffc 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -675,10 +675,6 @@ static struct cmd_results *cmd_move_in_direction( | |||
675 | return cmd_results_new(CMD_FAILURE, | 675 | return cmd_results_new(CMD_FAILURE, |
676 | "Cannot move workspaces in a direction"); | 676 | "Cannot move workspaces in a direction"); |
677 | } | 677 | } |
678 | if (container_is_scratchpad_hidden(container)) { | ||
679 | return cmd_results_new(CMD_FAILURE, | ||
680 | "Cannot move a hidden scratchpad container"); | ||
681 | } | ||
682 | if (container_is_floating(container)) { | 678 | if (container_is_floating(container)) { |
683 | if (container->fullscreen_mode) { | 679 | if (container->fullscreen_mode) { |
684 | return cmd_results_new(CMD_FAILURE, | 680 | return cmd_results_new(CMD_FAILURE, |
@@ -750,10 +746,6 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) { | |||
750 | return cmd_results_new(CMD_FAILURE, "Only floating containers " | 746 | return cmd_results_new(CMD_FAILURE, "Only floating containers " |
751 | "can be moved to an absolute position"); | 747 | "can be moved to an absolute position"); |
752 | } | 748 | } |
753 | if (container_is_scratchpad_hidden(container)) { | ||
754 | return cmd_results_new(CMD_FAILURE, | ||
755 | "Cannot move a hidden scratchpad container"); | ||
756 | } | ||
757 | 749 | ||
758 | if (!argc) { | 750 | if (!argc) { |
759 | return cmd_results_new(CMD_INVALID, expected_position_syntax); | 751 | return cmd_results_new(CMD_INVALID, expected_position_syntax); |
@@ -795,6 +787,10 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) { | |||
795 | ly = root->y + (root->height - container->height) / 2; | 787 | ly = root->y + (root->height - container->height) / 2; |
796 | } else { | 788 | } else { |
797 | struct sway_workspace *ws = container->workspace; | 789 | struct sway_workspace *ws = container->workspace; |
790 | if (!ws) { | ||
791 | struct sway_seat *seat = config->handler_context.seat; | ||
792 | ws = seat_get_focused_workspace(seat); | ||
793 | } | ||
798 | lx = ws->x + (ws->width - container->width) / 2; | 794 | lx = ws->x + (ws->width - container->width) / 2; |
799 | ly = ws->y + (ws->height - container->height) / 2; | 795 | ly = ws->y + (ws->height - container->height) / 2; |
800 | } | 796 | } |
@@ -828,8 +824,13 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) { | |||
828 | } | 824 | } |
829 | 825 | ||
830 | if (!absolute) { | 826 | if (!absolute) { |
831 | lx += container->workspace->x; | 827 | struct sway_workspace *ws = container->workspace; |
832 | ly += container->workspace->y; | 828 | if (!ws) { |
829 | struct sway_seat *seat = config->handler_context.seat; | ||
830 | ws = seat_get_focused_workspace(seat); | ||
831 | } | ||
832 | lx += ws->x; | ||
833 | ly += ws->y; | ||
833 | } | 834 | } |
834 | container_floating_move_to(container, lx, ly); | 835 | container_floating_move_to(container, lx, ly); |
835 | return cmd_results_new(CMD_SUCCESS, NULL); | 836 | return cmd_results_new(CMD_SUCCESS, NULL); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index 6620921f..b89047a7 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -880,6 +880,9 @@ void container_floating_move_to(struct sway_container *con, | |||
880 | return; | 880 | return; |
881 | } | 881 | } |
882 | container_floating_translate(con, lx - con->x, ly - con->y); | 882 | container_floating_translate(con, lx - con->x, ly - con->y); |
883 | if (container_is_scratchpad_hidden(con)) { | ||
884 | return; | ||
885 | } | ||
883 | struct sway_workspace *old_workspace = con->workspace; | 886 | struct sway_workspace *old_workspace = con->workspace; |
884 | struct sway_output *new_output = container_floating_find_output(con); | 887 | struct sway_output *new_output = container_floating_find_output(con); |
885 | if (!sway_assert(new_output, "Unable to find any output")) { | 888 | if (!sway_assert(new_output, "Unable to find any output")) { |