]> git.sur5r.net Git - i3/i3/blobdiff - src/xinerama.c
libi3: change scalloc() signature to match calloc()
[i3/i3] / src / xinerama.c
index b3e51ac535ae8f628f8e52d3bd33a9c35115b5e9..cae71fc2b0da8d155617ed9397c3b61c7b3d9170 100644 (file)
@@ -4,7 +4,7 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009 Michael Stapelberg and contributors (see also: LICENSE)
  *
  * This is LEGACY code (we support RandR, which can do much more than
  * Xinerama), but necessary for the poor users of the nVidia binary
@@ -15,7 +15,6 @@
 
 #include <xcb/xinerama.h>
 
-
 static int num_screens;
 
 /*
@@ -25,8 +24,8 @@ static int num_screens;
 static Output *get_screen_at(unsigned int x, unsigned int y) {
     Output *output;
     TAILQ_FOREACH(output, &outputs, outputs)
-        if (output->rect.x == x && output->rect.y == y)
-            return output;
+    if (output->rect.x == x && output->rect.y == y)
+        return output;
 
     return NULL;
 }
@@ -57,7 +56,7 @@ static void query_screens(xcb_connection_t *conn) {
             s->rect.width = min(s->rect.width, screen_info[screen].width);
             s->rect.height = min(s->rect.height, screen_info[screen].height);
         } else {
-            s = scalloc(sizeof(Output));
+            s = scalloc(1, sizeof(Output));
             sasprintf(&(s->name), "xinerama-%d", num_screens);
             DLOG("Created new Xinerama screen %s (%p)\n", s->name, s);
             s->active = true;
@@ -67,16 +66,17 @@ static void query_screens(xcb_connection_t *conn) {
             s->rect.height = screen_info[screen].height;
             /* We always treat the screen at 0x0 as the primary screen */
             if (s->rect.x == 0 && s->rect.y == 0)
-                    TAILQ_INSERT_HEAD(&outputs, s, outputs);
-            else TAILQ_INSERT_TAIL(&outputs, s, outputs);
+                TAILQ_INSERT_HEAD(&outputs, s, outputs);
+            else
+                TAILQ_INSERT_TAIL(&outputs, s, outputs);
             output_init_con(s);
             init_ws_for_output(s, output_get_content(s->con));
             num_screens++;
         }
 
         DLOG("found Xinerama screen: %d x %d at %d x %d\n",
-                        screen_info[screen].width, screen_info[screen].height,
-                        screen_info[screen].x_org, screen_info[screen].y_org);
+             screen_info[screen].width, screen_info[screen].height,
+             screen_info[screen].x_org, screen_info[screen].y_org);
     }
 
     free(reply);