output: evacuate sticky containers only if new output has a workspace

Sticky floating containers on an otherwise empty workspace can only be
evacuated if the new output has an active workspace. The noop output may
not have one and in that case we have to move the whole workspace to the
new output.
This commit is contained in:
mwenzkowski 2020-10-28 00:02:08 +01:00 committed by Tudor Brindus
parent 0cb9282aee
commit 32788a93f2
3 changed files with 41 additions and 23 deletions

View file

@ -817,3 +817,16 @@ size_t workspace_num_tiling_views(struct sway_workspace *ws) {
workspace_for_each_container(ws, count_tiling_views, &count);
return count;
}
static void count_sticky_containers(struct sway_container *con, void *data) {
if (container_is_floating(con) && con->is_sticky) {
size_t *count = data;
*count += 1;
}
}
size_t workspace_num_sticky_containers(struct sway_workspace *ws) {
size_t count = 0;
workspace_for_each_container(ws, count_sticky_containers, &count);
return count;
}