mirror of
https://github.com/swaywm/sway.git
synced 2024-11-04 23:43:14 +00:00
output: Revert implementation of evacuate_sticky()
The function evacuate_sticky() was changed in commit 32788a93
to be used
by workspace_for_each_container() to make the code more readable. But I
overlooked that it is not safe to use workspace_for_each_container() to
remove container from a workspace. This commit restores the previous
implementation for evacuate_sticky().
This commit is contained in:
parent
39328ca4e4
commit
4799cb0960
|
@ -152,18 +152,21 @@ void output_enable(struct sway_output *output) {
|
||||||
arrange_root();
|
arrange_root();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void evacuate_sticky(struct sway_container *con, void *data) {
|
static void evacuate_sticky(struct sway_workspace *old_ws,
|
||||||
if (container_is_floating(con) && con->is_sticky) {
|
struct sway_output *new_output) {
|
||||||
struct sway_workspace *new_ws = data;
|
struct sway_workspace *new_ws = output_get_active_workspace(new_output);
|
||||||
if (!sway_assert(new_ws, "Expected workspace to not be null")) {
|
if (!sway_assert(new_ws, "New output does not have a workspace")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
container_detach(con);
|
while(old_ws->floating->length) {
|
||||||
workspace_add_floating(new_ws, con);
|
struct sway_container *sticky = old_ws->floating->items[0];
|
||||||
container_handle_fullscreen_reparent(con);
|
container_detach(sticky);
|
||||||
container_floating_move_to_center(con);
|
workspace_add_floating(new_ws, sticky);
|
||||||
ipc_event_window(con, "move");
|
container_handle_fullscreen_reparent(sticky);
|
||||||
|
container_floating_move_to_center(sticky);
|
||||||
|
ipc_event_window(sticky, "move");
|
||||||
}
|
}
|
||||||
|
workspace_detect_urgent(new_ws);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_evacuate(struct sway_output *output) {
|
static void output_evacuate(struct sway_output *output) {
|
||||||
|
@ -198,10 +201,9 @@ static void output_evacuate(struct sway_output *output) {
|
||||||
if (workspace_is_empty(workspace)) {
|
if (workspace_is_empty(workspace)) {
|
||||||
// If the new output has an active workspace (the noop output may
|
// If the new output has an active workspace (the noop output may
|
||||||
// not have one), move all sticky containers to it
|
// not have one), move all sticky containers to it
|
||||||
if (new_output_ws) {
|
if (new_output_ws &&
|
||||||
workspace_for_each_container(workspace, evacuate_sticky,
|
workspace_num_sticky_containers(workspace) > 0) {
|
||||||
new_output_ws);
|
evacuate_sticky(workspace, new_output);
|
||||||
workspace_detect_urgent(new_output_ws);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workspace_num_sticky_containers(workspace) == 0) {
|
if (workspace_num_sticky_containers(workspace) == 0) {
|
||||||
|
|
Loading…
Reference in a new issue