mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
Take our own copy of the X connection that we are passed
* We need to copy the X display (by fetching its connection string and calling XOpenDisplay), so that if the Display* we had gets closed then nothing will crash.
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
namespace glEmulate { void EmulateUnsupportedFunctions(GLHookSet *hooks); }
|
||||
|
||||
// bit of a hack
|
||||
namespace Keyboard { extern Display *CurrentXDisplay; }
|
||||
namespace Keyboard { void CloneDisplay(Display *dpy); }
|
||||
|
||||
typedef GLXContext (*PFNGLXCREATECONTEXTPROC)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
|
||||
typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display *dpy, GLXContext ctx);
|
||||
@@ -578,7 +578,7 @@ GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList
|
||||
|
||||
int value = 0;
|
||||
|
||||
if(Keyboard::CurrentXDisplay == NULL) Keyboard::CurrentXDisplay = dpy;
|
||||
Keyboard::CloneDisplay(dpy);
|
||||
|
||||
OpenGLHook::glhooks.glXGetConfig_real(dpy, vis, GLX_BUFFER_SIZE, &value); init.colorBits = value;
|
||||
OpenGLHook::glhooks.glXGetConfig_real(dpy, vis, GLX_DEPTH_SIZE, &value); init.depthBits = value;
|
||||
@@ -674,7 +674,7 @@ GLXContext glXCreateContextAttribsARB(Display *dpy, GLXFBConfig config, GLXConte
|
||||
|
||||
int value = 0;
|
||||
|
||||
if(Keyboard::CurrentXDisplay == NULL) Keyboard::CurrentXDisplay = dpy;
|
||||
Keyboard::CloneDisplay(dpy);
|
||||
|
||||
OpenGLHook::glhooks.glXGetConfig_real(dpy, vis, GLX_BUFFER_SIZE, &value); init.colorBits = value;
|
||||
OpenGLHook::glhooks.glXGetConfig_real(dpy, vis, GLX_DEPTH_SIZE, &value); init.depthBits = value;
|
||||
|
||||
@@ -51,6 +51,13 @@ namespace Keyboard
|
||||
|
||||
Display *CurrentXDisplay = NULL;
|
||||
|
||||
void CloneDisplay(Display *dpy)
|
||||
{
|
||||
if(CurrentXDisplay || dpy == NULL) return;
|
||||
|
||||
CurrentXDisplay = XOpenDisplay(XDisplayString(dpy));
|
||||
}
|
||||
|
||||
void AddInputWindow(void *wnd)
|
||||
{
|
||||
// TODO check against this drawable & parent window being focused in GetKeyState
|
||||
|
||||
Reference in New Issue
Block a user