From 8069d56c8c0c48fb6fed8426103ed373688c4dfa Mon Sep 17 00:00:00 2001 From: Kamil Date: Mon, 11 Nov 2013 12:13:45 +0100 Subject: [PATCH] Parent window Added `parent` feature to cocoa and X11. Its need to be tested and I actually dont know how to do it with X11. --- src/cocoa_window.m | 8 +++++--- src/x11_window.c | 10 ++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cocoa_window.m b/src/cocoa_window.m index 81701941..016d12cd 100644 --- a/src/cocoa_window.m +++ b/src/cocoa_window.m @@ -844,7 +844,8 @@ static GLboolean initializeAppKit(void) // Create the Cocoa window // static GLboolean createWindow(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig) + const _GLFWwndconfig* wndconfig, + _GLFWwindow* parent) { unsigned int styleMask = 0; @@ -904,7 +905,8 @@ static GLboolean createWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig) + const _GLFWfbconfig* fbconfig, + _GLFWwindow* parent) { if (!initializeAppKit()) return GL_FALSE; @@ -938,7 +940,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (!createWindow(window, wndconfig)) return GL_FALSE; - if (!_glfwCreateContext(window, wndconfig, fbconfig)) + if (!_glfwCreateContext(window, wndconfig, fbconfig, parent)) return GL_FALSE; [window->nsgl.context setView:window->ns.view]; diff --git a/src/x11_window.c b/src/x11_window.c index 115ab1df..d3c8d4b1 100644 --- a/src/x11_window.c +++ b/src/x11_window.c @@ -100,7 +100,8 @@ static int translateChar(XKeyEvent* event) // Create the X11 window (and its colormap) // static GLboolean createWindow(_GLFWwindow* window, - const _GLFWwndconfig* wndconfig) + const _GLFWwndconfig* wndconfig, + _GLFWwindow* parent ) { unsigned long wamask; XSetWindowAttributes wa; @@ -139,7 +140,7 @@ static GLboolean createWindow(_GLFWwindow* window, _glfwGrabXErrorHandler(); window->x11.handle = XCreateWindow(_glfw.x11.display, - _glfw.x11.root, + parent ? parent->x11.handle , _glfw.x11.root, 0, 0, wndconfig->width, wndconfig->height, 0, // Border width @@ -936,12 +937,13 @@ unsigned long _glfwGetWindowProperty(Window window, int _glfwPlatformCreateWindow(_GLFWwindow* window, const _GLFWwndconfig* wndconfig, - const _GLFWfbconfig* fbconfig) + const _GLFWfbconfig* fbconfig, + _GLFWwindow* parent ) { if (!_glfwCreateContext(window, wndconfig, fbconfig)) return GL_FALSE; - if (!createWindow(window, wndconfig)) + if (!createWindow(window, wndconfig, parent)) return GL_FALSE; if (wndconfig->monitor)