12a711bc02dbc11bc18ce7fa9d7de6fc72749c61
[dana/dcompmgr.git] / dcompmgr.c
1 #include "screen.h"
2 #include "gettext.h"
3
4 #include <glib.h>
5 #include <stdio.h>
6 #include <string.h>
7 #include <xcb/xcb.h>
8
9 static gint
10 all_screens(xcb_connection_t *conn, d_screen_t **list)
11 {
12     static const xcb_setup_t *setup;
13     xcb_screen_iterator_t it;
14     int count, i;
15     d_screen_t sc;
16
17     setup = xcb_get_setup(conn);
18
19     count = i = 0;
20     for (it = xcb_setup_roots_iterator(setup); it.rem; xcb_screen_next(&it)) {
21         sc.super = *it.data;
22         sc.num = i++;
23         if (screen_register(conn, &sc)) {
24             ++count;
25             *list = g_renew(d_screen_t, *list, count);
26             (*list)[count-1] = sc;
27             printf(_("managing screen %d\n"), sc.num);
28         }
29     }
30     return count;
31 }
32
33 int
34 main(int argc, char **argv)
35 {
36     xcb_connection_t  *conn;
37     d_screen_t        *screens = NULL;
38
39     conn = xcb_connect(NULL, NULL);
40     if (!conn) {
41         printf(_("Unable to connect to display\n"));
42         return 1;
43     }
44
45     all_screens(conn, &screens);
46     
47
48     xcb_disconnect(conn);
49     return 0;
50 }