]> git.sur5r.net Git - i3/i3/commitdiff
randr: Look up alternative output names when searching outputs
authorVladimir Panteleev <git@thecybershadow.net>
Sat, 9 Sep 2017 09:23:50 +0000 (09:23 +0000)
committerVladimir Panteleev <git@thecybershadow.net>
Wed, 13 Sep 2017 08:23:26 +0000 (08:23 +0000)
Update get_output_by_name to look at all additional names added by the
change in the previous commit, not just the primary one.

src/randr.c

index 92d652b7b18eab1d5ec775bfff4853999978aa02..bc7916964356eb75ff760fa0dc07e5546af758da 100644 (file)
@@ -48,10 +48,18 @@ 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) ||
-            ((!require_active || output->active) && strcasecmp(output_primary_name(output), name) == 0)) {
+        if (output->primary && get_primary) {
             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;