no globals
[dana/dcompmgr.git] / dcompmgr.c
index 679284e..12a711b 100644 (file)
@@ -1,3 +1,50 @@
-int main(int argc, char **argv)
+#include "screen.h"
+#include "gettext.h"
+
+#include <glib.h>
+#include <stdio.h>
+#include <string.h>
+#include <xcb/xcb.h>
+
+static gint
+all_screens(xcb_connection_t *conn, d_screen_t **list)
 {
+    static const xcb_setup_t *setup;
+    xcb_screen_iterator_t it;
+    int count, i;
+    d_screen_t sc;
+
+    setup = xcb_get_setup(conn);
+
+    count = i = 0;
+    for (it = xcb_setup_roots_iterator(setup); it.rem; xcb_screen_next(&it)) {
+        sc.super = *it.data;
+        sc.num = i++;
+        if (screen_register(conn, &sc)) {
+            ++count;
+            *list = g_renew(d_screen_t, *list, count);
+            (*list)[count-1] = sc;
+            printf(_("managing screen %d\n"), sc.num);
+        }
+    }
+    return count;
+}
+
+int
+main(int argc, char **argv)
+{
+    xcb_connection_t  *conn;
+    d_screen_t        *screens = NULL;
+
+    conn = xcb_connect(NULL, NULL);
+    if (!conn) {
+        printf(_("Unable to connect to display\n"));
+        return 1;
+    }
+
+    all_screens(conn, &screens);
+    
+
+    xcb_disconnect(conn);
+    return 0;
 }