begin work on window attachment

This commit is contained in:
jgcodes2020 2023-07-30 21:47:07 -04:00
parent 3eaf1255b2
commit 4be2543f1e
2 changed files with 46 additions and 0 deletions

View File

@ -532,6 +532,7 @@ struct _GLFWwindow
GLFWbool focusOnShow;
GLFWbool mousePassthrough;
GLFWbool shouldClose;
GLFWbool external;
void* userPointer;
GLFWbool doublebuffer;
GLFWvidmode videoMode;
@ -706,6 +707,7 @@ struct _GLFWplatform
void (*setGammaRamp)(_GLFWmonitor*,const GLFWgammaramp*);
// window
GLFWbool (*createWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*);
GLFWbool (*attachWindow)(_GLFWwindow*,const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*);
void (*destroyWindow)(_GLFWwindow*);
void (*setWindowTitle)(_GLFWwindow*,const char*);
void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*);

View File

@ -254,6 +254,50 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
return (GLFWwindow*) window;
}
GLFWAPI GLFWwindow* glfwAttachWindow(intptr_t nativeWindow, GLFWwindow* share) {
_GLFWfbconfig fbconfig;
_GLFWctxconfig ctxconfig;
_GLFWwndconfig wndconfig;
_GLFWwindow* window;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
fbconfig = _glfw.hints.framebuffer;
ctxconfig = _glfw.hints.context;
wndconfig = _glfw.hints.window;
ctxconfig.share = (_GLFWwindow*) share;
if (ctxconfig.share)
{
if (ctxconfig.client == GLFW_NO_API ||
ctxconfig.share->context.client == GLFW_NO_API)
{
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
return NULL;
}
}
if (!_glfwIsValidContextConfig(&ctxconfig))
return NULL;
window = calloc(1, sizeof(_GLFWwindow));
window->next = _glfw.windowListHead;
_glfw.windowListHead = window;
window->autoIconify = wndconfig.autoIconify;
window->cursorMode = GLFW_CURSOR_NORMAL;
window->external = true;
window->minwidth = GLFW_DONT_CARE;
window->minheight = GLFW_DONT_CARE;
window->maxwidth = GLFW_DONT_CARE;
window->maxheight = GLFW_DONT_CARE;
window->numer = GLFW_DONT_CARE;
window->denom = GLFW_DONT_CARE;
// if (!_glfw.platform.attachWindow())
}
void glfwDefaultWindowHints(void)
{
_GLFW_REQUIRE_INIT();