17 void read_options(int argc, char **argv, d_options_t *opts)
19 opts->foo = argc && argv;
23 main(int argc, char **argv)
26 xcb_generic_event_t *ev;
29 read_options(argc, argv, &opts);
31 dpy = display_open(NULL);
33 printf(_("Unable to connect to display\n"));
37 if (!dpy->composite.present) {
38 printf(_("no composite extension present on the display\n"));
42 if (!dpy->xfixes.present) {
43 printf(_("no xfixes extension present on the display\n"));
47 if (!dpy->damage.present) {
48 printf(_("no damage extension present on the display\n"));
52 if (!dpy->render.present) {
53 printf(_("no render extension present on the display\n"));
57 if (dpy->composite.major_version <= 0 && dpy->composite.minor_version < 3)
59 printf(_("composite extension does not support the overlay window"));
64 if (!display_claim_screens(dpy)) {
65 printf(_("found no screens to run on\n"));
70 while ((ev = xcb_wait_for_event(dpy->conn))) {
71 printf("event %d\n", ev->response_type);
73 if (!ev->response_type) {
74 display_error(dpy, (xcb_generic_error_t*)ev);
79 switch (ev->response_type) {
80 case XCB_CREATE_NOTIFY:
82 xcb_create_notify_event_t *cev;
85 cev = (xcb_create_notify_event_t*)ev;
86 sc = display_screen_from_root(dpy, cev->parent);
88 screen_add_window(sc, cev->window);
91 case XCB_DESTROY_NOTIFY:
93 xcb_destroy_notify_event_t *dev;
97 dev = (xcb_destroy_notify_event_t*)ev;
98 sc = display_screen_from_root(dpy, dev->event);
100 w = screen_find_window(sc, dev->window);
102 screen_remove_window(sc, w);
105 case XCB_REPARENT_NOTIFY:
107 xcb_reparent_notify_event_t *rev;
111 rev = (xcb_reparent_notify_event_t*)ev;
112 sc = display_screen_from_root(dpy, rev->event);
114 w = screen_find_window(sc, rev->window);
115 if (rev->parent == sc->super.root)
116 screen_add_window(sc, rev->window);
119 screen_remove_window(sc, w);
125 xcb_map_notify_event_t *mev;
129 mev = (xcb_map_notify_event_t*)ev;
130 sc = display_screen_from_root(dpy, mev->event);
132 w = screen_find_window(sc, mev->window);
136 case XCB_UNMAP_NOTIFY:
138 xcb_unmap_notify_event_t *mev;
142 mev = (xcb_unmap_notify_event_t*)ev;
143 sc = display_screen_from_root(dpy, mev->event);
145 w = screen_find_window(sc, mev->window);