summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2020-05-14 21:53:21 +0200
committerMichael Stapelberg <michael@stapelberg.de>2020-07-22 09:32:29 +0200
commit551d0a5b13bf1720a14465ded86e9dcd85e11573 (patch)
tree466e65afaab9fd9913681c3da62283407d016823
parent96639c04106de630efa0eee1662f5f049e4a324d (diff)
downloadi3-551d0a5b13bf1720a14465ded86e9dcd85e11573.tar.gz
i3-551d0a5b13bf1720a14465ded86e9dcd85e11573.zip
get_output_by_name: guard output->primary with require_active
This is related to #4048 but might not fix it completely. Either way, this should be the correct behaviour of the function.
-rw-r--r--src/randr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/randr.c b/src/randr.c
index 9a0bf5cc..1e87a7db 100644
--- a/src/randr.c
+++ b/src/randr.c
@@ -48,12 +48,12 @@ Output *get_output_by_name(const char *name, const bool require_active) {
Output *output;
bool get_primary = (strcasecmp("primary", name) == 0);
TAILQ_FOREACH(output, &outputs, outputs) {
- if (output->primary && get_primary) {
- return output;
- }
if (require_active && !output->active) {
continue;
}
+ if (output->primary && get_primary) {
+ return output;
+ }
struct output_name *output_name;
SLIST_FOREACH(output_name, &output->names_head, names) {
if (strcasecmp(output_name->name, name) == 0) {