no globals
[dana/dcompmgr.git] / dcompmgr.c
index 9008a16..12a711b 100644 (file)
@@ -6,10 +6,8 @@
 #include <string.h>
 #include <xcb/xcb.h>
 
-static d_screen_t        *screens = NULL;
-
 static gint
-all_screens(xcb_connection_t *conn)
+all_screens(xcb_connection_t *conn, d_screen_t **list)
 {
     static const xcb_setup_t *setup;
     xcb_screen_iterator_t it;
@@ -24,8 +22,8 @@ all_screens(xcb_connection_t *conn)
         sc.num = i++;
         if (screen_register(conn, &sc)) {
             ++count;
-            screens = g_renew(d_screen_t, screens, count);
-            screens[count-1] = sc;
+            *list = g_renew(d_screen_t, *list, count);
+            (*list)[count-1] = sc;
             printf(_("managing screen %d\n"), sc.num);
         }
     }
@@ -36,6 +34,7 @@ int
 main(int argc, char **argv)
 {
     xcb_connection_t  *conn;
+    d_screen_t        *screens = NULL;
 
     conn = xcb_connect(NULL, NULL);
     if (!conn) {
@@ -43,7 +42,7 @@ main(int argc, char **argv)
         return 1;
     }
 
-    all_screens(conn);
+    all_screens(conn, &screens);
     
 
     xcb_disconnect(conn);