| 34 | // corresponding VirtualWin instances are shut down. |
| 35 | |
| 36 | int XCloseDisplay(Display *dpy) |
| 37 | { |
| 38 | // MainWin calls various X11 functions from the destructor of one of its |
| 39 | // shared libraries, which is executed after the VirtualGL Faker has shut |
| 40 | // down, so we cannot access fconfig or vglout or winh without causing |
| 41 | // deadlocks or other issues. At this point, all we can safely do is hand |
| 42 | // off to libX11. |
| 43 | if(faker::deadYet || faker::getFakerLevel() > 0) |
| 44 | return _XCloseDisplay(dpy); |
| 45 | |
| 46 | int retval = 0; |
| 47 | TRY(); |
| 48 | |
| 49 | ///////////////////////////////////////////////////////////////////////////// |
| 50 | OPENTRACE(XCloseDisplay); PRARGD(dpy); STARTTRACE(); |
| 51 | ///////////////////////////////////////////////////////////////////////////// |
| 52 | |
| 53 | DISABLE_FAKER(); |
| 54 | |
| 55 | #ifdef FAKEXCB |
| 56 | if(fconfig.fakeXCB) |
| 57 | { |
| 58 | CHECKSYM_NONFATAL(XGetXCBConnection) |
| 59 | if(!__XGetXCBConnection) |
| 60 | { |
| 61 | if(fconfig.verbose) |
| 62 | vglout.print("[VGL] Disabling XCB interposer\n"); |
| 63 | fconfig.fakeXCB = 0; |
| 64 | } |
| 65 | else |
| 66 | { |
| 67 | xcb_connection_t *conn = _XGetXCBConnection(dpy); |
| 68 | XCBCONNHASH.remove(conn); |
| 69 | } |
| 70 | } |
| 71 | #endif |
| 72 | |
| 73 | WINHASH.remove(dpy); |
| 74 | retval = _XCloseDisplay(dpy); |
| 75 | |
| 76 | ///////////////////////////////////////////////////////////////////////////// |
| 77 | STOPTRACE(); CLOSETRACE(); |
| 78 | ///////////////////////////////////////////////////////////////////////////// |
| 79 | |
| 80 | CATCH(); |
| 81 | ENABLE_FAKER(); |
| 82 | return retval; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | // We have to override this function in order to handle GLX pixmap rendering |