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

View File

@ -254,6 +254,50 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
return (GLFWwindow*) window; 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) void glfwDefaultWindowHints(void)
{ {
_GLFW_REQUIRE_INIT(); _GLFW_REQUIRE_INIT();