mirror of
https://github.com/swaywm/sway.git
synced 2026-03-07 04:34:20 -05:00
tree/workspace: fix output priority in workspace assignment
workspace_valid_on_output() and workspace_next_name() check whether an output appears anywhere in a workspace's output list, ignoring priority order. This allows a lower-priority output to claim a workspace even when a higher-priority output is available. Fix by stopping early when iterating the output list: if a different available output is found before the current one, the workspace belongs to that higher-priority output.
This commit is contained in:
parent
fa497964fd
commit
99e17d5efb
1 changed files with 6 additions and 0 deletions
|
|
@ -205,6 +205,9 @@ static bool workspace_valid_on_output(const char *output_name,
|
|||
if (output_match_name_or_id(output, wsc->outputs->items[i])) {
|
||||
return true;
|
||||
}
|
||||
if (output_by_name_or_id(wsc->outputs->items[i])) {
|
||||
return false; // a higher-priority output is available
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -326,6 +329,9 @@ char *workspace_next_name(const char *output_name) {
|
|||
target = strdup(wsc->workspace);
|
||||
break;
|
||||
}
|
||||
if (output_by_name_or_id(wsc->outputs->items[j])) {
|
||||
break; // a higher-priority output is available
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue