mirror of
https://github.com/glfw/glfw.git
synced 2026-09-23 00:59:48 +00:00
Add GLFW_NO_API for creating context-less windows
This commit is contained in:
+19
-10
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user