diff options
author | lbonn <bonnans.l@gmail.com> | 2019-08-20 00:01:17 +0200 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-27 09:37:10 +0900 |
commit | 2c2d6018bbee5d935889673c4cd84737b741807e (patch) | |
tree | e4a737d22ea5bfe48eaf7cae94ed4f620bf80aa6 | |
parent | sway.5: remove mention of floating_scroll (diff) | |
download | sway-2c2d6018bbee5d935889673c4cd84737b741807e.tar.gz sway-2c2d6018bbee5d935889673c4cd84737b741807e.tar.zst sway-2c2d6018bbee5d935889673c4cd84737b741807e.zip |
Allow moving a container hidden in scratchpad
(as i3 allows it)
Just update the container's coordinates so that they will be applied at
the next show.
-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 7068e166..df0a3fea 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -900,6 +900,9 @@ void container_floating_move_to(struct sway_container *con, | |||
900 | return; | 900 | return; |
901 | } | 901 | } |
902 | container_floating_translate(con, lx - con->x, ly - con->y); | 902 | container_floating_translate(con, lx - con->x, ly - con->y); |
903 | if (container_is_scratchpad_hidden(con)) { | ||
904 | return; | ||
905 | } | ||
903 | struct sway_workspace *old_workspace = con->workspace; | 906 | struct sway_workspace *old_workspace = con->workspace; |
904 | struct sway_output *new_output = container_floating_find_output(con); | 907 | struct sway_output *new_output = container_floating_find_output(con); |
905 | if (!sway_assert(new_output, "Unable to find any output")) { | 908 | if (!sway_assert(new_output, "Unable to find any output")) { |