In Xlib, XWindowAttributes structure contains a pointer to the screen that the window is on. But in the corresponding structure of XCB (xcb_get_window_attributes_reply_t), there is no such member.
What should I do?
I don't think there's a direct way to get the screen of a window.
What you can do is find the root window ancestor of your window, then iterate over all the screens until you find the one owning your root.