MCPcopy Create free account
hub / github.com/VirtualGL/virtualgl / xhandler

Function xhandler

client/vglclient.cpp:65–83  ·  view source on GitHub ↗

This does nothing except prevent Xlib from exiting the program, so we can trap X11 errors

Source from the content-addressed store, hash-verified

63// This does nothing except prevent Xlib from exiting the program, so we can
64// trap X11 errors
65int xhandler(Display *dpy, XErrorEvent *xe)
66{
67 const char *temp = NULL; char errmsg[257]; bool printWarnings = false;
68 char *env = NULL;
69
70 if((env = getenv("VGL_VERBOSE")) != NULL && strlen(env) > 0
71 && !strncmp(env, "1", 1)) printWarnings = true;
72 if(printWarnings)
73 {
74 errmsg[0] = 0;
75 XGetErrorText(dpy, xe->error_code, errmsg, 256);
76 vglout.print("X11 Error: ");
77 if((temp = x11error(xe->error_code)) != NULL
78 && stricmp(temp, "Unknown error code"))
79 vglout.print("%s ", temp);
80 vglout.println("%s", errmsg);
81 }
82 return 1;
83}
84
85} // extern "C"
86

Callers

nothing calls this directly

Calls 4

getenvFunction · 0.85
x11errorFunction · 0.85
printlnMethod · 0.80
printMethod · 0.45

Tested by

no test coverage detected