mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 15:23:17 +01:00
Add glfwGetGLXFBConfig native access function
This adds the glfwGetGLXFBConfig function for querying the GLXFBConfig the GLXWindow of a window. This commit is a squashed and modified version of PR #1925 by knokko. The following changes were made by elmindreda: The function signature was changed to handle GLXFBConfig being an opaque value in core GLX. The function error checks were fixed and updated. The struct member name was changed. The struct member clearing on context destruction was removed. All documentation snippets were updated. Closes #1925
This commit is contained in:
@@ -626,6 +626,8 @@ GLFWbool _glfwCreateContextGLX(_GLFWwindow* window,
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
window->context.glx.fbconfig = native;
|
||||
|
||||
window->context.makeCurrent = makeContextCurrentGLX;
|
||||
window->context.swapBuffers = swapBuffersGLX;
|
||||
window->context.swapInterval = swapIntervalGLX;
|
||||
@@ -719,5 +721,29 @@ GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow* handle)
|
||||
return window->context.glx.window;
|
||||
}
|
||||
|
||||
GLFWAPI int glfwGetGLXFBConfig(GLFWwindow* handle, GLXFBConfig* config)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_X11)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "GLX: Platform not initialized");
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
_GLFWwindow* window = (_GLFWwindow*) handle;
|
||||
assert(window != NULL);
|
||||
assert(config != NULL);
|
||||
|
||||
if (window->context.source != GLFW_NATIVE_CONTEXT_API)
|
||||
{
|
||||
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||
return GLFW_FALSE;
|
||||
}
|
||||
|
||||
*config = window->context.glx.fbconfig;
|
||||
return GLFW_TRUE;
|
||||
}
|
||||
|
||||
#endif // _GLFW_X11
|
||||
|
||||
|
||||
@@ -470,6 +470,7 @@ typedef struct _GLFWcontextGLX
|
||||
{
|
||||
GLXContext handle;
|
||||
GLXWindow window;
|
||||
GLXFBConfig fbconfig;
|
||||
} _GLFWcontextGLX;
|
||||
|
||||
// GLX-specific global data
|
||||
|
||||
Reference in New Issue
Block a user