}
+static xcb_screen_t *
+get_xcb_screen(xcb_screen_iterator_t iter, int screen)
+{
+ for (; iter.rem; --screen, xcb_screen_next(&iter))
+ if (screen == 0)
+ return iter.data;
+
+ return NULL;
+}
+
+
/**
* Called via eglCreateWindowSurface(), drv->API.CreateWindowSurface().
*/
dri2_surf->drawable = xcb_generate_id(dri2_dpy->conn);
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
xcb_create_pixmap(dri2_dpy->conn, conf->BufferSize,
- dri2_surf->drawable, s.data->root,
+ dri2_surf->drawable,
+ get_xcb_screen(s, dri2_dpy->screen)->root,
dri2_surf->base.Width, dri2_surf->base.Height);
} else {
dri2_surf->drawable = drawable;
XCB_DRI2_MINOR_VERSION);
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
- connect_cookie = xcb_dri2_connect_unchecked (dri2_dpy->conn,
- s.data->root,
- XCB_DRI2_DRIVER_TYPE_DRI);
+ connect_cookie = xcb_dri2_connect_unchecked(dri2_dpy->conn,
+ get_xcb_screen(s, dri2_dpy->screen)->root,
+ XCB_DRI2_DRIVER_TYPE_DRI);
xfixes_query =
xcb_xfixes_query_version_reply (dri2_dpy->conn,
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
authenticate_cookie =
- xcb_dri2_authenticate_unchecked(dri2_dpy->conn, s.data->root, id);
+ xcb_dri2_authenticate_unchecked(dri2_dpy->conn,
+ get_xcb_screen(s, dri2_dpy->screen)->root, id);
authenticate =
xcb_dri2_authenticate_reply(dri2_dpy->conn, authenticate_cookie, NULL);
};
s = xcb_setup_roots_iterator(xcb_get_setup(dri2_dpy->conn));
- d = xcb_screen_allowed_depths_iterator(s.data);
+ d = xcb_screen_allowed_depths_iterator(get_xcb_screen(s, dri2_dpy->screen));
id = 1;
surface_type =
disp->DriverData = (void *) dri2_dpy;
if (disp->PlatformDisplay == NULL) {
- dri2_dpy->conn = xcb_connect(0, 0);
+ dri2_dpy->conn = xcb_connect(0, &dri2_dpy->screen);
dri2_dpy->own_device = true;
} else {
- dri2_dpy->conn = XGetXCBConnection((Display *) disp->PlatformDisplay);
+ Display *dpy = disp->PlatformDisplay;
+
+ dri2_dpy->conn = XGetXCBConnection(dpy);
+ dri2_dpy->screen = DefaultScreen(dpy);
}
if (xcb_connection_has_error(dri2_dpy->conn)) {
disp->DriverData = (void *) dri2_dpy;
if (disp->PlatformDisplay == NULL) {
- dri2_dpy->conn = xcb_connect(0, 0);
+ dri2_dpy->conn = xcb_connect(0, &dri2_dpy->screen);
dri2_dpy->own_device = true;
} else {
- dri2_dpy->conn = XGetXCBConnection((Display *) disp->PlatformDisplay);
+ Display *dpy = disp->PlatformDisplay;
+
+ dri2_dpy->conn = XGetXCBConnection(dpy);
+ dri2_dpy->screen = DefaultScreen(dpy);
}
if (xcb_connection_has_error(dri2_dpy->conn)) {