| 615 | // really it's getting an off-screen drawable. |
| 616 | |
| 617 | GLXWindow glXCreateWindow(Display *dpy, GLXFBConfig config_, Window win, |
| 618 | const int *attrib_list) |
| 619 | { |
| 620 | faker::VirtualWin *vw = NULL; |
| 621 | VGLFBConfig config = (VGLFBConfig)config_; |
| 622 | |
| 623 | TRY(); |
| 624 | |
| 625 | if(IS_EXCLUDED(dpy)) |
| 626 | return _glXCreateWindow(dpy, config_, win, attrib_list); |
| 627 | |
| 628 | ///////////////////////////////////////////////////////////////////////////// |
| 629 | OPENTRACE(glXCreateWindow); PRARGD(dpy); PRARGC(config); PRARGX(win); |
| 630 | STARTTRACE(); |
| 631 | ///////////////////////////////////////////////////////////////////////////// |
| 632 | |
| 633 | DISABLE_FAKER(); |
| 634 | |
| 635 | XSync(dpy, False); |
| 636 | if(!VALID_CONFIG(config)) |
| 637 | { |
| 638 | faker::sendGLXError(dpy, X_GLXCreateWindow, GLXBadFBConfig, false); |
| 639 | win = 0; |
| 640 | goto done; |
| 641 | } |
| 642 | if(!win) |
| 643 | { |
| 644 | faker::sendGLXError(dpy, X_GLXCreateWindow, BadWindow, true); |
| 645 | goto done; |
| 646 | } |
| 647 | try |
| 648 | { |
| 649 | vw = WINHASH.initVW(dpy, win, config); |
| 650 | if(!vw && !GLXDHASH.getCurrentDisplay(win)) |
| 651 | { |
| 652 | // Apparently win was created in another process or using XCB. |
| 653 | WINHASH.add(dpy, win); |
| 654 | vw = WINHASH.initVW(dpy, win, config); |
| 655 | } |
| 656 | } |
| 657 | catch(std::exception &e) |
| 658 | { |
| 659 | if(!strcmp(GET_METHOD(e), "VirtualWin") |
| 660 | && !strcmp(e.what(), "Invalid window")) |
| 661 | { |
| 662 | faker::sendGLXError(dpy, X_GLXCreateWindow, BadWindow, true); |
| 663 | win = 0; |
| 664 | goto done; |
| 665 | } |
| 666 | throw; |
| 667 | } |
| 668 | if(!vw) |
| 669 | THROW("Cannot create virtual window for specified X window"); |
| 670 | |
| 671 | done: |
| 672 | ///////////////////////////////////////////////////////////////////////////// |
| 673 | STOPTRACE(); if(vw) { PRARGX(vw->getGLXDrawable()); } |
| 674 | CLOSETRACE(); |