MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / init_xcb_connection

Method init_xcb_connection

cube/cube.cpp:1272–1297  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1270
1271#if defined(VK_USE_PLATFORM_XCB_KHR)
1272const char *Demo::init_xcb_connection() {
1273 xcb_library = initialize_xcb();
1274 if (NULL == xcb_library) {
1275 return "Cannot load XLIB dynamic library.";
1276 }
1277 const xcb_setup_t *setup;
1278 xcb_screen_iterator_t iter;
1279 int scr;
1280
1281 const char *display_envar = getenv("DISPLAY");
1282 if (display_envar == nullptr || display_envar[0] == '\0') {
1283 return "Environment variable DISPLAY requires a valid value.";
1284 }
1285
1286 connection = xcb_connect(nullptr, &scr);
1287 if (xcb_connection_has_error(connection) > 0) {
1288 return "Cannot connect to XCB.";
1289 }
1290
1291 setup = xcb_get_setup(connection);
1292 iter = xcb_setup_roots_iterator(setup);
1293 while (scr-- > 0) xcb_screen_next(&iter);
1294
1295 screen = iter.data;
1296 return NULL;
1297}
1298#endif
1299#if defined(VK_USE_PLATFORM_XLIB_KHR)
1300const char *Demo::init_xlib_connection() {

Callers

nothing calls this directly

Calls 1

initialize_xcbFunction · 0.85

Tested by

no test coverage detected