+ mask = ROOT_MASK;
+ xcb_change_window_attributes(sc->conn, sc->super.root,
+ XCB_CW_EVENT_MASK, &mask);
+}
+
+void
+screen_add_window(d_screen_t *sc, xcb_create_notify_event_t *cev)
+{
+ d_window_t *w;
+
+ w = window_new(cev->window, sc);
+ g_hash_table_insert(sc->winhash, &w->id, w);
+
+ printf("added window 0x%x\n", w->id);
+}
+
+void
+screen_remove_window(d_screen_t *sc, struct d_window *w)
+{
+ printf("removed window 0x%x\n", w->id);
+
+ g_hash_table_remove(sc->winhash, &w->id);
+ window_unref(w);
+}
+
+d_window_t*
+screen_find_window(d_screen_t *sc, xcb_window_t id)
+{
+ return g_hash_table_lookup(sc->winhash, &id);
+}
+
+void
+screen_show_window(d_screen_t *sc, struct d_window *w)
+{
+}
+
+void
+screen_hide_window(d_screen_t *sc, struct d_window *w)
+{
+}
+
+static xcb_timestamp_t
+screen_timestamp(d_screen_t *sc)
+{
+ xcb_void_cookie_t ck;
+ xcb_timestamp_t time;
+
+ ck = xcb_change_property(sc->conn, XCB_PROP_MODE_REPLACE, sc->selwin,
+ sc->selatom, sc->selatom, 32, 0, NULL);
+ xcb_flush(sc->conn);
+ while (1) {
+ xcb_generic_event_t *ev;
+
+ ev = xcb_wait_for_event(sc->conn);
+ if (!ev) {
+ printf(_("IO error\n"));
+ exit(0);
+ }
+
+ /* expect errors.. */
+ if (!ev->response_type) {
+ /* XXX handle error */
+ free(ev);
+ continue;
+ }
+
+ if (ev->response_type == XCB_PROPERTY_NOTIFY &&
+ ev->full_sequence == ck.sequence)
+ {
+ time = ((xcb_property_notify_event_t*)ev)->time;
+ free(ev);
+ break;
+ }
+ }
+ printf("created timestamp %lu\n", (unsigned long) time);
+ return time;