mirror of
https://github.com/swaywm/sway.git
synced 2026-03-07 04:34:20 -05:00
simplify output priority check
This commit is contained in:
parent
99e17d5efb
commit
f66b69762d
1 changed files with 12 additions and 12 deletions
|
|
@ -202,11 +202,10 @@ static bool workspace_valid_on_output(const char *output_name,
|
|||
}
|
||||
|
||||
for (int i = 0; i < wsc->outputs->length; i++) {
|
||||
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
|
||||
struct sway_output *ws_output =
|
||||
output_by_name_or_id(wsc->outputs->items[i]);
|
||||
if (ws_output) {
|
||||
return ws_output == output;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -323,15 +322,16 @@ char *workspace_next_name(const char *output_name) {
|
|||
}
|
||||
bool found = false;
|
||||
for (int j = 0; j < wsc->outputs->length; ++j) {
|
||||
if (output_match_name_or_id(output, wsc->outputs->items[j])) {
|
||||
found = true;
|
||||
free(target);
|
||||
target = strdup(wsc->workspace);
|
||||
struct sway_output *ws_output =
|
||||
output_by_name_or_id(wsc->outputs->items[j]);
|
||||
if (ws_output) {
|
||||
if (ws_output == output) {
|
||||
found = true;
|
||||
free(target);
|
||||
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