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

Function instanceCheck

client/vglclient.cpp:243–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

241
242
243unsigned short instanceCheck(Display *dpy)
244{
245 Atom atom = None; unsigned short p = 0;
246 if((atom = XInternAtom(dpy, "_VGLCLIENT_PORT", True)) != None)
247 {
248 unsigned char *prop = NULL; unsigned long n = 0, bytesLeft = 0;
249 int actualFormat = 0; Atom actualType = None;
250 if(XGetWindowProperty(dpy, DefaultRootWindow(dpy), atom, 0, 1, False,
251 XA_INTEGER, &actualType, &actualFormat, &n, &bytesLeft,
252 &prop) == Success
253 && n >= 1 && actualFormat == 16 && actualType == XA_INTEGER && prop)
254 p = *(unsigned short *)prop;
255 if(prop) XFree(prop);
256 if(p != 0)
257 {
258 vglout.println("vglclient is already running on this X display and accepting connections on");
259 vglout.println(" port %d.", p);
260 }
261 }
262 return p;
263}
264
265
266void getEnvironment(void)

Callers 1

startFunction · 0.85

Calls 2

XFreeFunction · 0.85
printlnMethod · 0.80

Tested by

no test coverage detected