randr: Look up alternative output names when searching outputs
Update get_output_by_name to look at all additional names added by the change in the previous commit, not just the primary one.
This commit is contained in:
parent
08ad82c3bb
commit
c35cacfd78
12
src/randr.c
12
src/randr.c
|
@ -48,10 +48,18 @@ Output *get_output_by_name(const char *name, const bool require_active) {
|
||||||
Output *output;
|
Output *output;
|
||||||
bool get_primary = (strcasecmp("primary", name) == 0);
|
bool get_primary = (strcasecmp("primary", name) == 0);
|
||||||
TAILQ_FOREACH(output, &outputs, outputs) {
|
TAILQ_FOREACH(output, &outputs, outputs) {
|
||||||
if ((output->primary && get_primary) ||
|
if (output->primary && get_primary) {
|
||||||
((!require_active || output->active) && strcasecmp(output_primary_name(output), name) == 0)) {
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
if (require_active && !output->active) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
struct output_name *output_name;
|
||||||
|
SLIST_FOREACH(output_name, &output->names_head, names) {
|
||||||
|
if (strcasecmp(output_name->name, name) == 0) {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue