]> git.sur5r.net Git - i3/i3/commitdiff
randr: Don’t enable outputs with mode 0x0
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 26 Mar 2010 00:52:08 +0000 (01:52 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 26 Mar 2010 00:52:08 +0000 (01:52 +0100)
Just a sanity check for some possibly broken drivers.

src/randr.c

index 42dd884452a4744f4dfa603af7e049b1f6ea3024..d46ffbc4b866a36f5e26557d21e7209e62e5acf9 100644 (file)
@@ -339,11 +339,16 @@ static void handle_output(xcb_connection_t *conn, xcb_randr_output_t id,
                 return;
         }
 
-        new->active = true;
         bool updated = update_if_necessary(&(new->rect.x), crtc->x) |
                        update_if_necessary(&(new->rect.y), crtc->y) |
                        update_if_necessary(&(new->rect.width), crtc->width) |
                        update_if_necessary(&(new->rect.height), crtc->height);
+        free(crtc);
+        new->active = (new->rect.width != 0 && new->rect.height != 0);
+        if (!new->active) {
+                DLOG("width/height 0/0, disabling output\n");
+                return;
+        }
 
         DLOG("mode: %dx%d+%d+%d\n", new->rect.width, new->rect.height,
                                     new->rect.x, new->rect.y);