aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 675edb2d..f5cb2f9e 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -667,10 +667,8 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
667 } 667 }
668 668
669 // find new output's old workspace, which might have to be removed if empty 669 // find new output's old workspace, which might have to be removed if empty
670 struct sway_workspace *new_output_last_ws = NULL; 670 struct sway_workspace *new_output_last_ws =
671 if (new_output && last_output != new_output) { 671 new_output ? output_get_active_workspace(new_output) : NULL;
672 new_output_last_ws = output_get_active_workspace(new_output);
673 }
674 672
675 // Unfocus the previous focus 673 // Unfocus the previous focus
676 if (last_focus) { 674 if (last_focus) {
@@ -719,8 +717,17 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
719 ipc_event_window(container, "focus"); 717 ipc_event_window(container, "focus");
720 } 718 }
721 719
722 if (new_output_last_ws) { 720 // Move sticky containers to new workspace
723 workspace_consider_destroy(new_output_last_ws); 721 if (new_output_last_ws && new_workspace != new_output_last_ws) {
722 for (int i = 0; i < new_output_last_ws->floating->length; ++i) {
723 struct sway_container *floater =
724 new_output_last_ws->floating->items[i];
725 if (floater->is_sticky) {
726 container_detach(floater);
727 workspace_add_floating(new_workspace, floater);
728 --i;
729 }
730 }
724 } 731 }
725 732
726 // Close any popups on the old focus 733 // Close any popups on the old focus
@@ -754,11 +761,14 @@ void seat_set_focus_warp(struct sway_seat *seat, struct sway_node *node,
754 container_raise_floating(container); 761 container_raise_floating(container);
755 } 762 }
756 763
757 if (last_focus) { 764 if (new_output_last_ws) {
758 if (last_workspace) { 765 workspace_consider_destroy(new_output_last_ws);
759 workspace_consider_destroy(last_workspace); 766 }
760 } 767 if (last_workspace && last_workspace != new_output_last_ws) {
768 workspace_consider_destroy(last_workspace);
769 }
761 770
771 if (last_focus) {
762 if (config->mouse_warping && warp && new_output != last_output) { 772 if (config->mouse_warping && warp && new_output != last_output) {
763 double x = 0; 773 double x = 0;
764 double y = 0; 774 double y = 0;