Add GLFW_NO_API for creating context-less windows

This commit is contained in:
Camilla Berglund
2015-06-18 14:03:02 +02:00
parent 0fda5b7b80
commit 496f559c9a
17 changed files with 285 additions and 191 deletions
+19 -10
View File
@@ -248,17 +248,16 @@ static char** parseUriList(char* text, int* count)
// Create the X11 window (and its colormap)
//
static GLFWbool createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig)
const _GLFWwndconfig* wndconfig,
Visual* visual, int depth)
{
XVisualInfo* vi = _GLFW_X11_CONTEXT_VISUAL;
// Every window needs a colormap
// Create one based on the visual used by the current context
// TODO: Decouple this from context creation
window->x11.colormap = XCreateColormap(_glfw.x11.display,
_glfw.x11.root,
vi->visual,
visual,
AllocNone);
// Create the actual window
@@ -279,10 +278,10 @@ static GLFWbool createWindow(_GLFWwindow* window,
_glfw.x11.root,
0, 0,
wndconfig->width, wndconfig->height,
0, // Border width
vi->depth, // Color depth
0, // Border width
depth, // Color depth
InputOutput,
vi->visual,
visual,
wamask,
&wa);
@@ -1467,12 +1466,21 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWctxconfig* ctxconfig,
const _GLFWfbconfig* fbconfig)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
Visual* visual;
int depth;
if (!_glfwChooseVisual(ctxconfig, fbconfig, &visual, &depth))
return GLFW_FALSE;
if (!createWindow(window, wndconfig))
if (!createWindow(window, wndconfig, visual, depth))
return GLFW_FALSE;
if (ctxconfig->api != GLFW_NO_API)
{
if (!_glfwCreateContext(window, ctxconfig, fbconfig))
return GLFW_FALSE;
}
if (wndconfig->monitor)
{
_glfwPlatformShowWindow(window);
@@ -1493,7 +1501,8 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
window->x11.ic = NULL;
}
_glfwDestroyContext(window);
if (window->context.api != GLFW_NO_API)
_glfwDestroyContext(window);
if (window->x11.handle)
{