1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-10-08 15:17:25 -04:00

Merged GLX error code into library struct.

This commit is contained in:
Camilla Berglund 2013-05-02 16:37:55 +02:00
parent be28914732
commit 6b7f5671f8
2 changed files with 7 additions and 8 deletions

View File

@ -53,10 +53,6 @@ void (*glXGetProcAddressEXT(const GLubyte* procName))();
#endif
// The X error code as provided to the X error handler
//
static unsigned long _glfwErrorCode = Success;
// The per-thread current context/window pointer
//
static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
@ -66,7 +62,7 @@ static _GLFW_TLS _GLFWwindow* _glfwCurrentWindow = NULL;
//
static int errorHandler(Display *display, XErrorEvent* event)
{
_glfwErrorCode = event->error_code;
_glfw.glx.errorCode = event->error_code;
return 0;
}
@ -393,7 +389,7 @@ int _glfwCreateContext(_GLFWwindow* window,
}
}
_glfwErrorCode = Success;
_glfw.glx.errorCode = Success;
XSetErrorHandler(errorHandler);
if (_glfw.glx.ARB_create_context)
@ -465,7 +461,7 @@ int _glfwCreateContext(_GLFWwindow* window,
// HACK: This is a fallback for the broken Mesa implementation of
// GLX_ARB_create_context_profile, which fails default 1.0 context
// creation with a GLXBadProfileARB error in violation of the spec
if (_glfwErrorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
if (_glfw.glx.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
wndconfig->clientAPI == GLFW_OPENGL_API &&
wndconfig->glProfile == GLFW_OPENGL_NO_PROFILE &&
wndconfig->glForward == GL_FALSE)
@ -485,7 +481,7 @@ int _glfwCreateContext(_GLFWwindow* window,
{
char buffer[8192];
XGetErrorText(_glfw.x11.display,
_glfwErrorCode,
_glfw.glx.errorCode,
buffer, sizeof(buffer));
_glfwInputError(GLFW_PLATFORM_ERROR,

View File

@ -93,6 +93,9 @@ typedef struct _GLFWlibraryGLX
int eventBase;
int errorBase;
// GLX error code received by Xlib error callback
int errorCode;
// GLX extensions
PFNGLXSWAPINTERVALSGIPROC SwapIntervalSGI;
PFNGLXSWAPINTERVALEXTPROC SwapIntervalEXT;