8 #include <sys/select.h>
18 read_options(int argc, char **argv, d_options_t *opts)
20 opts->foo = argc && argv;
24 event(d_display_t *dpy)
26 xcb_generic_event_t *ev;
28 ev = xcb_poll_for_event(dpy->conn);
29 printf("event %d\n", ev->response_type);
31 if (!ev->response_type) {
32 display_error(dpy, (xcb_generic_error_t*)ev);
37 switch (ev->response_type) {
38 case XCB_CREATE_NOTIFY:
40 xcb_create_notify_event_t *cev;
43 cev = (xcb_create_notify_event_t*)ev;
44 sc = display_screen_from_root(dpy, cev->parent);
46 screen_add_window(sc, cev->window);
49 case XCB_DESTROY_NOTIFY:
51 xcb_destroy_notify_event_t *dev;
55 dev = (xcb_destroy_notify_event_t*)ev;
56 sc = display_screen_from_root(dpy, dev->event);
58 w = screen_find_window(sc, dev->window);
60 screen_remove_window(sc, w);
63 case XCB_REPARENT_NOTIFY:
65 xcb_reparent_notify_event_t *rev;
69 rev = (xcb_reparent_notify_event_t*)ev;
70 sc = display_screen_from_root(dpy, rev->event);
72 w = screen_find_window(sc, rev->window);
73 if (rev->parent == sc->super.root)
74 screen_add_window(sc, rev->window);
77 screen_remove_window(sc, w);
83 xcb_map_notify_event_t *mev;
87 mev = (xcb_map_notify_event_t*)ev;
88 sc = display_screen_from_root(dpy, mev->event);
90 w = screen_find_window(sc, mev->window);
94 case XCB_UNMAP_NOTIFY:
96 xcb_unmap_notify_event_t *mev;
100 mev = (xcb_unmap_notify_event_t*)ev;
101 sc = display_screen_from_root(dpy, mev->event);
103 w = screen_find_window(sc, mev->window);
114 run(d_display_t *dpy)
121 FD_SET(dpy->fd, &fds);
122 max = MAX(max, dpy->fd);
128 r = select(max+1, &fds, NULL, NULL, NULL);
130 printf("select error\n");
132 printf("select timeout\n");
134 printf("select data\n");
135 /*if (FD_ISSET(dpy->fd, &fds))*/ {
140 if (xcb_connection_has_error(dpy->conn))
146 main(int argc, char **argv)
151 read_options(argc, argv, &opts);
153 dpy = display_open(NULL);
155 printf(_("Unable to connect to display\n"));
159 if (!dpy->composite.present) {
160 printf(_("no composite extension present on the display\n"));
164 if (!dpy->xfixes.present) {
165 printf(_("no xfixes extension present on the display\n"));
169 if (!dpy->damage.present) {
170 printf(_("no damage extension present on the display\n"));
174 if (!dpy->render.present) {
175 printf(_("no render extension present on the display\n"));
179 if (dpy->composite.major_version <= 0 && dpy->composite.minor_version < 3)
181 printf(_("composite extension does not support the overlay window"));
186 if (!display_claim_screens(dpy)) {
187 printf(_("found no screens to run on\n"));