6 #define ROOT_MASK (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY)
9 screen_register(xcb_connection_t *conn, d_screen_t *sc)
14 xcb_intern_atom_cookie_t ack;
15 xcb_intern_atom_reply_t *arep;
16 xcb_get_selection_owner_cookie_t sck;
17 xcb_get_selection_owner_reply_t *srep;
20 w = xcb_generate_id(conn);
21 xcb_create_window(conn, XCB_COPY_FROM_PARENT, w, sc->super.root,
22 0, 0, 1, 1, 0, XCB_WINDOW_CLASS_INPUT_ONLY,
23 sc->super.root_visual, 0, NULL);
25 name = g_strdup_printf("_NET_WM_CM_S%d", sc->num);
26 ack = xcb_intern_atom(conn, FALSE, strlen(name), name);
27 arep = xcb_intern_atom_reply(conn, ack, NULL);
30 sck = xcb_get_selection_owner(conn, arep->atom);
31 srep = xcb_get_selection_owner_reply(conn, sck, NULL);
32 taken = !!srep->owner;
35 printf(_("screen %d already has a composite manager, skipping\n"),
40 xcb_set_selection_owner(conn, w, arep->atom, XCB_CURRENT_TIME);
41 sck = xcb_get_selection_owner(conn, arep->atom);
42 srep = xcb_get_selection_owner_reply(conn, sck, NULL);
43 taken = srep->owner == w;
49 xcb_destroy_window(conn, w);
54 void screen_listen(xcb_connection_t *conn, d_screen_t *sc)
56 const uint32_t mask = ROOT_MASK;
57 xcb_change_window_attributes(conn, sc->super.root,
58 XCB_CW_EVENT_MASK, &mask);