Use get_assigned_output for numbers
This prohibits the usage of workspaces assigned to other outputs in create_workspace_on_output. Eg, with config: workspace 1 output fake-0 workspace 2 output fake-0 and 2 screens workspace 2 would be used for the second screen even though it is assigned to the first one. Also introduces a test for workspace assignments that includes the case described above and some tests that don't fail in the next branch.
This commit is contained in:
@ -248,7 +248,9 @@ Con *create_workspace_on_output(Output *output, Con *content) {
|
||||
DLOG("Getting next unused workspace by number\n");
|
||||
int c = 0;
|
||||
while (exists) {
|
||||
exists = (get_existing_workspace_by_num(++c) != NULL);
|
||||
c++;
|
||||
Con *assigned = get_assigned_output(NULL, c);
|
||||
exists = (get_existing_workspace_by_num(c) || (assigned && assigned != output->con));
|
||||
DLOG("result for ws %d: exists = %d\n", c, exists);
|
||||
}
|
||||
ws->num = c;
|
||||
|
Reference in New Issue
Block a user