From 4be2543f1e0e92d87fd83b9b8ddb3b6f0e651367 Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Sun, 30 Jul 2023 21:47:07 -0400 Subject: [PATCH 1/7] begin work on window attachment --- src/internal.h | 2 ++ src/window.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/internal.h b/src/internal.h index fe0369aa..2af37d86 100644 --- a/src/internal.h +++ b/src/internal.h @@ -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*); diff --git a/src/window.c b/src/window.c index 1c8519ff..09a80d00 100644 --- a/src/window.c +++ b/src/window.c @@ -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(); From edef7ff345c1cefb4cbe2ad325dde11356353566 Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Tue, 24 Oct 2023 11:56:27 -0400 Subject: [PATCH 2/7] more infrastructure for wayland --- .gitignore | 4 +++ src/internal.h | 2 +- src/window.c | 8 ++--- src/wl_init.c | 2 +- src/wl_platform.h | 1 + src/wl_window.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 90 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 84636a0a..57cafd8d 100644 --- a/.gitignore +++ b/.gitignore @@ -101,3 +101,7 @@ tests/triangle-vulkan tests/window tests/windows +# IDE caches +.cache/ +.idea/ +.vscode/ \ No newline at end of file diff --git a/src/internal.h b/src/internal.h index 2af37d86..05c1f5cc 100644 --- a/src/internal.h +++ b/src/internal.h @@ -707,7 +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*); + GLFWbool (*attachWindow)(_GLFWwindow*, intptr_t, const _GLFWwndconfig*,const _GLFWctxconfig*,const _GLFWfbconfig*); void (*destroyWindow)(_GLFWwindow*); void (*setWindowTitle)(_GLFWwindow*,const char*); void (*setWindowIcon)(_GLFWwindow*,int,const GLFWimage*); diff --git a/src/window.c b/src/window.c index 09a80d00..25096e8c 100644 --- a/src/window.c +++ b/src/window.c @@ -295,11 +295,12 @@ GLFWAPI GLFWwindow* glfwAttachWindow(intptr_t nativeWindow, GLFWwindow* share) { window->numer = GLFW_DONT_CARE; window->denom = GLFW_DONT_CARE; -// if (!_glfw.platform.attachWindow()) + if (!_glfw.platform.attachWindow(window, nativeWindow, &wndconfig, &ctxconfig, &fbconfig)) + return NULL; } -void glfwDefaultWindowHints(void) -{ +void glfwDefaultWindowHints(void) { + _GLFW_REQUIRE_INIT(); // The default is OpenGL with minimum version 1.0 @@ -1196,4 +1197,3 @@ GLFWAPI void glfwPostEmptyEvent(void) _GLFW_REQUIRE_INIT(); _glfw.platform.postEmptyEvent(); } - diff --git a/src/wl_init.c b/src/wl_init.c index 66d77dca..220dcecd 100644 --- a/src/wl_init.c +++ b/src/wl_init.c @@ -428,6 +428,7 @@ GLFWbool _glfwConnectWayland(int platformID, _GLFWplatform* platform) _glfwGetGammaRampWayland, _glfwSetGammaRampWayland, _glfwCreateWindowWayland, + _glfwAttachWindowWayland, _glfwDestroyWindowWayland, _glfwSetWindowTitleWayland, _glfwSetWindowIconWayland, @@ -919,4 +920,3 @@ void _glfwTerminateWayland(void) } #endif // _GLFW_WAYLAND - diff --git a/src/wl_platform.h b/src/wl_platform.h index e9dd0b4a..20b69802 100644 --- a/src/wl_platform.h +++ b/src/wl_platform.h @@ -608,6 +608,7 @@ int _glfwInitWayland(void); void _glfwTerminateWayland(void); GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwAttachWindowWayland(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowWayland(_GLFWwindow* window); void _glfwSetWindowTitleWayland(_GLFWwindow* window, const char* title); void _glfwSetWindowIconWayland(_GLFWwindow* window, int count, const GLFWimage* images); diff --git a/src/wl_window.c b/src/wl_window.c index 7b9e3d0d..5fddb50c 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -966,6 +966,36 @@ static GLFWbool createNativeSurface(_GLFWwindow* window, return GLFW_TRUE; } +static GLFWbool attachNativeSurface(_GLFWwindow* window, + intptr_t native, + const _GLFWwndconfig* wndconfig, + const _GLFWfbconfig* fbconfig) { + if (!native) + { + _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: supplied wl_surface is null"); + return GLFW_FALSE; + } + window->wl.surface = (struct wl_surface*) native; + + wl_proxy_set_tag((struct wl_proxy*) window->wl.surface, &_glfw.wl.tag); + wl_surface_add_listener(window->wl.surface, + &surfaceListener, + window); + + window->wl.width = wndconfig->width; + window->wl.height = wndconfig->height; + window->wl.contentScale = 1; + window->wl.title = _glfw_strdup(wndconfig->title); + window->wl.appId = _glfw_strdup(wndconfig->wl.appId); + + + window->wl.maximized = wndconfig->maximized; + + window->wl.transparent = fbconfig->transparent; + if (!window->wl.transparent) + setContentAreaOpaque(window); +} + static void setCursorImage(_GLFWwindow* window, _GLFWcursorWayland* cursorWayland) { @@ -2046,7 +2076,8 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, if (wndconfig->mousePassthrough) _glfwSetWindowMousePassthroughWayland(window, GLFW_TRUE); - if (window->monitor || wndconfig->visible) + // don't + if (!window->external && (window->monitor || wndconfig->visible)) { if (!createShellObjects(window)) return GLFW_FALSE; @@ -2055,6 +2086,52 @@ GLFWbool _glfwCreateWindowWayland(_GLFWwindow* window, return GLFW_TRUE; } +GLFWbool _glfwAttachWindowWayland(_GLFWwindow* window, + intptr_t native, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { + + if (!attachNativeSurface(window, native, wndconfig, fbconfig)) + return GLFW_FALSE; + if (ctxconfig->client != GLFW_NO_API) + { + if (ctxconfig->source == GLFW_EGL_CONTEXT_API || + ctxconfig->source == GLFW_NATIVE_CONTEXT_API) + { + window->wl.egl.window = wl_egl_window_create(window->wl.surface, + wndconfig->width, + wndconfig->height); + if (!window->wl.egl.window) + { + _glfwInputError(GLFW_PLATFORM_ERROR, + "Wayland: Failed to create EGL window"); + return GLFW_FALSE; + } + + if (!_glfwInitEGL()) + return GLFW_FALSE; + if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) + return GLFW_FALSE; + } + else if (ctxconfig->source == GLFW_OSMESA_CONTEXT_API) + { + if (!_glfwInitOSMesa()) + return GLFW_FALSE; + if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) + return GLFW_FALSE; + } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; + } + + if (wndconfig->mousePassthrough) + _glfwSetWindowMousePassthroughWayland(window, GLFW_TRUE); + + return GLFW_TRUE; +} + void _glfwDestroyWindowWayland(_GLFWwindow* window) { if (window == _glfw.wl.pointerFocus) @@ -2324,7 +2401,7 @@ void _glfwMaximizeWindowWayland(_GLFWwindow* window) void _glfwShowWindowWayland(_GLFWwindow* window) { - if (!window->wl.libdecor.frame && !window->wl.xdg.toplevel) + if (!window->external && (!window->wl.libdecor.frame && !window->wl.xdg.toplevel)) { // NOTE: The XDG surface and role are created here so command-line applications // with off-screen windows do not appear in for example the Unity dock @@ -3173,4 +3250,3 @@ GLFWAPI struct wl_surface* glfwGetWaylandWindow(GLFWwindow* handle) } #endif // _GLFW_WAYLAND - From 3dfc46db21647c0bfbdf31fec74cef048e562389 Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Tue, 24 Oct 2023 12:10:30 -0400 Subject: [PATCH 3/7] implement dummy API for null and X11 --- src/null_init.c | 2 +- src/null_platform.h | 2 +- src/null_window.c | 89 ++++++++++++++++++++++++++++++++++++++++++++- src/x11_init.c | 2 +- src/x11_platform.h | 2 +- src/x11_window.c | 10 ++++- 6 files changed, 101 insertions(+), 6 deletions(-) diff --git a/src/null_init.c b/src/null_init.c index 7236c98c..8d93e944 100644 --- a/src/null_init.c +++ b/src/null_init.c @@ -71,6 +71,7 @@ GLFWbool _glfwConnectNull(int platformID, _GLFWplatform* platform) _glfwGetGammaRampNull, _glfwSetGammaRampNull, _glfwCreateWindowNull, + _glfwAttachWindowNull, _glfwDestroyWindowNull, _glfwSetWindowTitleNull, _glfwSetWindowIconNull, @@ -263,4 +264,3 @@ void _glfwTerminateNull(void) _glfwTerminateOSMesa(); _glfwTerminateEGL(); } - diff --git a/src/null_platform.h b/src/null_platform.h index 6d900111..5d0f4b95 100644 --- a/src/null_platform.h +++ b/src/null_platform.h @@ -210,6 +210,7 @@ GLFWbool _glfwGetGammaRampNull(_GLFWmonitor* monitor, GLFWgammaramp* ramp); void _glfwSetGammaRampNull(_GLFWmonitor* monitor, const GLFWgammaramp* ramp); GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwAttachWindowNull(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowNull(_GLFWwindow* window); void _glfwSetWindowTitleNull(_GLFWwindow* window, const char* title); void _glfwSetWindowIconNull(_GLFWwindow* window, int count, const GLFWimage* images); @@ -270,4 +271,3 @@ GLFWbool _glfwGetPhysicalDevicePresentationSupportNull(VkInstance instance, VkPh VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, _GLFWwindow* window, const VkAllocationCallbacks* allocator, VkSurfaceKHR* surface); void _glfwPollMonitorsNull(void); - diff --git a/src/null_window.c b/src/null_window.c index e0bbb3b6..cb22d715 100644 --- a/src/null_window.c +++ b/src/null_window.c @@ -106,6 +106,39 @@ static int createNativeWindow(_GLFWwindow* window, return GLFW_TRUE; } +static int attachNativeWindow(_GLFWwindow* window, + intptr_t native, + const _GLFWwndconfig* wndconfig, + const _GLFWfbconfig* fbconfig) +{ + if (window->monitor) + fitToMonitor(window); + else + { + if (wndconfig->xpos == GLFW_ANY_POSITION && wndconfig->ypos == GLFW_ANY_POSITION) + { + window->null.xpos = 17; + window->null.ypos = 17; + } + else + { + window->null.xpos = wndconfig->xpos; + window->null.ypos = wndconfig->ypos; + } + + window->null.width = wndconfig->width; + window->null.height = wndconfig->height; + } + + window->null.visible = wndconfig->visible; + window->null.decorated = wndconfig->decorated; + window->null.maximized = wndconfig->maximized; + window->null.floating = wndconfig->floating; + window->null.transparent = fbconfig->transparent; + window->null.opacity = 1.f; + + return GLFW_TRUE; +} ////////////////////////////////////////////////////////////////////////// @@ -166,6 +199,61 @@ GLFWbool _glfwCreateWindowNull(_GLFWwindow* window, return GLFW_TRUE; } +GLFWbool _glfwAttachWindowNull(_GLFWwindow* window, + intptr_t native, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) +{ + if (!attachNativeWindow(window, native, wndconfig, fbconfig)) + return GLFW_FALSE; + + if (ctxconfig->client != GLFW_NO_API) + { + if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API || + ctxconfig->source == GLFW_OSMESA_CONTEXT_API) + { + if (!_glfwInitOSMesa()) + return GLFW_FALSE; + if (!_glfwCreateContextOSMesa(window, ctxconfig, fbconfig)) + return GLFW_FALSE; + } + else if (ctxconfig->source == GLFW_EGL_CONTEXT_API) + { + if (!_glfwInitEGL()) + return GLFW_FALSE; + if (!_glfwCreateContextEGL(window, ctxconfig, fbconfig)) + return GLFW_FALSE; + } + + if (!_glfwRefreshContextAttribs(window, ctxconfig)) + return GLFW_FALSE; + } + + if (wndconfig->mousePassthrough) + _glfwSetWindowMousePassthroughNull(window, GLFW_TRUE); + + if (window->monitor) + { + _glfwShowWindowNull(window); + _glfwFocusWindowNull(window); + acquireMonitor(window); + + if (wndconfig->centerCursor) + _glfwCenterCursorInContentArea(window); + } + else + { + if (wndconfig->visible) + { + _glfwShowWindowNull(window); + if (wndconfig->focused) + _glfwFocusWindowNull(window); + } + } + + return GLFW_TRUE; +} void _glfwDestroyWindowNull(_GLFWwindow* window) { @@ -717,4 +805,3 @@ VkResult _glfwCreateWindowSurfaceNull(VkInstance instance, // This seems like the most appropriate error to return here return VK_ERROR_EXTENSION_NOT_PRESENT; } - diff --git a/src/x11_init.c b/src/x11_init.c index a0100f2f..fe2a9f62 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -1206,6 +1206,7 @@ GLFWbool _glfwConnectX11(int platformID, _GLFWplatform* platform) _glfwGetGammaRampX11, _glfwSetGammaRampX11, _glfwCreateWindowX11, + _glfwAttachWindowX11, _glfwDestroyWindowX11, _glfwSetWindowTitleX11, _glfwSetWindowIconX11, @@ -1655,4 +1656,3 @@ void _glfwTerminateX11(void) } #endif // _GLFW_X11 - diff --git a/src/x11_platform.h b/src/x11_platform.h index cdea3957..fc7cdae9 100644 --- a/src/x11_platform.h +++ b/src/x11_platform.h @@ -902,6 +902,7 @@ int _glfwInitX11(void); void _glfwTerminateX11(void); GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwAttachWindowX11(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowX11(_GLFWwindow* window); void _glfwSetWindowTitleX11(_GLFWwindow* window, const char* title); void _glfwSetWindowIconX11(_GLFWwindow* window, int count, const GLFWimage* images); @@ -1001,4 +1002,3 @@ GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig, Visual** visual, int* depth); - diff --git a/src/x11_window.c b/src/x11_window.c index 7da9b965..1df4f8c8 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2044,6 +2044,15 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, return GLFW_TRUE; } +GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, + intptr_t native, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { + _glfwInputError(GLFW_PLATFORM_ERROR, "X11 window attachment is not implemented"); + return GLFW_FALSE; +} + void _glfwDestroyWindowX11(_GLFWwindow* window) { if (_glfw.x11.disabledCursorWindow == window) @@ -3352,4 +3361,3 @@ GLFWAPI const char* glfwGetX11SelectionString(void) } #endif // _GLFW_X11 - From ab9cf8ba08688886dda891a013d8a447149737ad Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Tue, 24 Oct 2023 12:13:55 -0400 Subject: [PATCH 4/7] fix X11 platform --- src/x11_monitor.c | 1 - src/x11_window.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/x11_monitor.c b/src/x11_monitor.c index 3183630b..16c25fdc 100644 --- a/src/x11_monitor.c +++ b/src/x11_monitor.c @@ -617,4 +617,3 @@ GLFWAPI RROutput glfwGetX11Monitor(GLFWmonitor* handle) } #endif // _GLFW_X11 - diff --git a/src/x11_window.c b/src/x11_window.c index 1df4f8c8..892dd801 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -2044,7 +2044,7 @@ GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, return GLFW_TRUE; } -GLFWbool _glfwCreateWindowX11(_GLFWwindow* window, +GLFWbool _glfwAttachWindowX11(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, From d0b91e22f490a83156242bc37e889638723efe05 Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Tue, 24 Oct 2023 12:20:31 -0400 Subject: [PATCH 5/7] fix a couple of warnings --- src/window.c | 2 ++ src/wl_window.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/window.c b/src/window.c index 25096e8c..372e7651 100644 --- a/src/window.c +++ b/src/window.c @@ -297,6 +297,8 @@ GLFWAPI GLFWwindow* glfwAttachWindow(intptr_t nativeWindow, GLFWwindow* share) { if (!_glfw.platform.attachWindow(window, nativeWindow, &wndconfig, &ctxconfig, &fbconfig)) return NULL; + + return (GLFWwindow*) window; } void glfwDefaultWindowHints(void) { diff --git a/src/wl_window.c b/src/wl_window.c index 5fddb50c..97ae34a7 100644 --- a/src/wl_window.c +++ b/src/wl_window.c @@ -994,6 +994,8 @@ static GLFWbool attachNativeSurface(_GLFWwindow* window, window->wl.transparent = fbconfig->transparent; if (!window->wl.transparent) setContentAreaOpaque(window); + + return GLFW_TRUE; } static void setCursorImage(_GLFWwindow* window, From 6c38a99923bf9538ef5268c097f7f57898107066 Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Tue, 24 Oct 2023 14:17:54 -0400 Subject: [PATCH 6/7] ACTUALLY fix all errors --- src/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index 372e7651..ae07612e 100644 --- a/src/window.c +++ b/src/window.c @@ -286,7 +286,7 @@ GLFWAPI GLFWwindow* glfwAttachWindow(intptr_t nativeWindow, GLFWwindow* share) { window->autoIconify = wndconfig.autoIconify; window->cursorMode = GLFW_CURSOR_NORMAL; - window->external = true; + window->external = GLFW_TRUE; window->minwidth = GLFW_DONT_CARE; window->minheight = GLFW_DONT_CARE; From 36a3c1ef321d9a992d17691f655b9e14d867cc5b Mon Sep 17 00:00:00 2001 From: jgcodes2020 Date: Tue, 24 Oct 2023 18:17:06 -0400 Subject: [PATCH 7/7] Provide dummy endpoints for Cocoa/Win32 --- src/cocoa_init.m | 2 +- src/cocoa_platform.h | 2 +- src/cocoa_window.m | 10 +++++++++- src/win32_init.c | 2 +- src/win32_platform.h | 2 +- src/win32_window.c | 6 +++++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/cocoa_init.m b/src/cocoa_init.m index b3831df1..d925b4bd 100644 --- a/src/cocoa_init.m +++ b/src/cocoa_init.m @@ -525,6 +525,7 @@ GLFWbool _glfwConnectCocoa(int platformID, _GLFWplatform* platform) _glfwGetGammaRampCocoa, _glfwSetGammaRampCocoa, _glfwCreateWindowCocoa, + _glfwAttachWindowCocoa, _glfwDestroyWindowCocoa, _glfwSetWindowTitleCocoa, _glfwSetWindowIconCocoa, @@ -694,4 +695,3 @@ void _glfwTerminateCocoa(void) } #endif // _GLFW_COCOA - diff --git a/src/cocoa_platform.h b/src/cocoa_platform.h index 9f7d191d..76d79226 100644 --- a/src/cocoa_platform.h +++ b/src/cocoa_platform.h @@ -215,6 +215,7 @@ int _glfwInitCocoa(void); void _glfwTerminateCocoa(void); GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwAttachWindowCocoa(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowCocoa(_GLFWwindow* window); void _glfwSetWindowTitleCocoa(_GLFWwindow* window, const char* title); void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images); @@ -299,4 +300,3 @@ GLFWbool _glfwCreateContextNSGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyContextNSGL(_GLFWwindow* window); - diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 6f8aa978..e2034183 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -983,6 +983,15 @@ GLFWbool _glfwCreateWindowCocoa(_GLFWwindow* window, } // autoreleasepool } +GLFWbool _glfwAttachWindowCocoa(_GLFWwindow* window, + intptr_t native, + const _GLFWwndconfig* wndconfig, + const _GLFWctxconfig* ctxconfig, + const _GLFWfbconfig* fbconfig) { + _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa window attachment is not implemented"); + return GLFW_FALSE; +} + void _glfwDestroyWindowCocoa(_GLFWwindow* window) { @autoreleasepool { @@ -2050,4 +2059,3 @@ GLFWAPI id glfwGetCocoaWindow(GLFWwindow* handle) } #endif // _GLFW_COCOA - diff --git a/src/win32_init.c b/src/win32_init.c index ef2615f1..17766077 100644 --- a/src/win32_init.c +++ b/src/win32_init.c @@ -635,6 +635,7 @@ GLFWbool _glfwConnectWin32(int platformID, _GLFWplatform* platform) _glfwGetGammaRampWin32, _glfwSetGammaRampWin32, _glfwCreateWindowWin32, + _glfwAttachWindowWin32, _glfwDestroyWindowWin32, _glfwSetWindowTitleWin32, _glfwSetWindowIconWin32, @@ -728,4 +729,3 @@ void _glfwTerminateWin32(void) } #endif // _GLFW_WIN32 - diff --git a/src/win32_platform.h b/src/win32_platform.h index 82b34bb9..a0b2b041 100644 --- a/src/win32_platform.h +++ b/src/win32_platform.h @@ -540,6 +540,7 @@ void _glfwRestoreVideoModeWin32(_GLFWmonitor* monitor); void _glfwGetHMONITORContentScaleWin32(HMONITOR handle, float* xscale, float* yscale); GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); +GLFWbool _glfwAttachWindowWin32(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); void _glfwDestroyWindowWin32(_GLFWwindow* window); void _glfwSetWindowTitleWin32(_GLFWwindow* window, const char* title); void _glfwSetWindowIconWin32(_GLFWwindow* window, int count, const GLFWimage* images); @@ -621,4 +622,3 @@ void _glfwTerminateWGL(void); GLFWbool _glfwCreateContextWGL(_GLFWwindow* window, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig); - diff --git a/src/win32_window.c b/src/win32_window.c index 676640bf..2e7652e8 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1501,6 +1501,11 @@ GLFWbool _glfwCreateWindowWin32(_GLFWwindow* window, return GLFW_TRUE; } +GLFWbool _glfwAttachWindowWin32(_GLFWwindow* window, intptr_t native, const _GLFWwndconfig* wndconfig, const _GLFWctxconfig* ctxconfig, const _GLFWfbconfig* fbconfig) { + _glfwInputError(GLFW_PLATFORM_ERROR, "Win32 window attachment is not implemented"); + return GLFW_FALSE; +} + void _glfwDestroyWindowWin32(_GLFWwindow* window) { if (window->monitor) @@ -2501,4 +2506,3 @@ GLFWAPI HWND glfwGetWin32Window(GLFWwindow* handle) } #endif // _GLFW_WIN32 -