mirror of
https://github.com/i3/i3.git
synced 2025-12-01 12:06:20 +00:00
Merge pull request #4084 from orestisfl/get_output_by_name_primary_active
get_output_by_name: guard output->primary with require_active
This commit is contained in:
@ -51,12 +51,12 @@ 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) {
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
if (require_active && !output->active) {
|
if (require_active && !output->active) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (output->primary && get_primary) {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
struct output_name *output_name;
|
struct output_name *output_name;
|
||||||
SLIST_FOREACH (output_name, &output->names_head, names) {
|
SLIST_FOREACH (output_name, &output->names_head, names) {
|
||||||
if (strcasecmp(output_name->name, name) == 0) {
|
if (strcasecmp(output_name->name, name) == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user