mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 09:01:46 +00:00
Moved remaining X visual management into opengl module.
This commit is contained in:
parent
f77c8f8b21
commit
a22fbf7e9b
@ -637,6 +637,12 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
|
||||
void _glfwDestroyContext(_GLFWwindow* window)
|
||||
{
|
||||
if (window->GLX.visual)
|
||||
{
|
||||
XFree(window->GLX.visual);
|
||||
window->GLX.visual = NULL;
|
||||
}
|
||||
|
||||
if (window->GLX.context)
|
||||
{
|
||||
// Release and destroy the context
|
||||
@ -647,6 +653,16 @@ void _glfwDestroyContext(_GLFWwindow* window)
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Return the X visual associated with the specified context
|
||||
//========================================================================
|
||||
|
||||
XVisualInfo* _glfwGetContextVisual(_GLFWwindow* window)
|
||||
{
|
||||
return window->GLX.visual;
|
||||
}
|
||||
|
||||
|
||||
//========================================================================
|
||||
// Make the OpenGL context associated with the specified window current
|
||||
//========================================================================
|
||||
|
@ -289,6 +289,7 @@ int _glfwCreateContext(_GLFWwindow* window,
|
||||
const _GLFWwndconfig* wndconfig,
|
||||
const _GLFWfbconfig* fbconfig);
|
||||
void _glfwDestroyContext(_GLFWwindow* window);
|
||||
XVisualInfo* _glfwGetContextVisual(_GLFWwindow* window);
|
||||
|
||||
// Fullscreen support
|
||||
int _glfwGetClosestVideoMode(int* width, int* height, int* rate);
|
||||
|
@ -97,13 +97,14 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
XEvent event;
|
||||
unsigned long wamask;
|
||||
XSetWindowAttributes wa;
|
||||
XVisualInfo* visual = _glfwGetContextVisual(window);
|
||||
|
||||
// Every window needs a colormap
|
||||
// Create one based on the visual used by the current context
|
||||
|
||||
window->X11.colormap = XCreateColormap(_glfwLibrary.X11.display,
|
||||
_glfwLibrary.X11.root,
|
||||
window->GLX.visual->visual,
|
||||
visual->visual,
|
||||
AllocNone);
|
||||
|
||||
// Create the actual window
|
||||
@ -133,9 +134,9 @@ static GLboolean createWindow(_GLFWwindow* window,
|
||||
0, 0, // Upper left corner of this window on root
|
||||
window->width, window->height,
|
||||
0, // Border width
|
||||
window->GLX.visual->depth, // Color depth
|
||||
visual->depth, // Color depth
|
||||
InputOutput,
|
||||
window->GLX.visual->visual,
|
||||
visual->visual,
|
||||
wamask,
|
||||
&wa
|
||||
);
|
||||
@ -979,12 +980,6 @@ void _glfwPlatformCloseWindow(_GLFWwindow* window)
|
||||
|
||||
_glfwDestroyContext(window);
|
||||
|
||||
if (window->GLX.visual)
|
||||
{
|
||||
XFree(window->GLX.visual);
|
||||
window->GLX.visual = NULL;
|
||||
}
|
||||
|
||||
if (window->X11.handle)
|
||||
{
|
||||
XUnmapWindow(_glfwLibrary.X11.display, window->X11.handle);
|
||||
|
Loading…
Reference in New Issue
Block a user