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.
This commit is contained in:
Kamil 2013-11-11 12:13:45 +01:00
parent ef463151b1
commit 8069d56c8c
2 changed files with 11 additions and 7 deletions

View File

@ -844,7 +844,8 @@ static GLboolean initializeAppKit(void)
// Create the Cocoa window // Create the Cocoa window
// //
static GLboolean createWindow(_GLFWwindow* window, static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig) const _GLFWwndconfig* wndconfig,
_GLFWwindow* parent)
{ {
unsigned int styleMask = 0; unsigned int styleMask = 0;
@ -904,7 +905,8 @@ static GLboolean createWindow(_GLFWwindow* window,
int _glfwPlatformCreateWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig, const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig,
_GLFWwindow* parent)
{ {
if (!initializeAppKit()) if (!initializeAppKit())
return GL_FALSE; return GL_FALSE;
@ -938,7 +940,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!createWindow(window, wndconfig)) if (!createWindow(window, wndconfig))
return GL_FALSE; return GL_FALSE;
if (!_glfwCreateContext(window, wndconfig, fbconfig)) if (!_glfwCreateContext(window, wndconfig, fbconfig, parent))
return GL_FALSE; return GL_FALSE;
[window->nsgl.context setView:window->ns.view]; [window->nsgl.context setView:window->ns.view];

View File

@ -100,7 +100,8 @@ static int translateChar(XKeyEvent* event)
// Create the X11 window (and its colormap) // Create the X11 window (and its colormap)
// //
static GLboolean createWindow(_GLFWwindow* window, static GLboolean createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig) const _GLFWwndconfig* wndconfig,
_GLFWwindow* parent )
{ {
unsigned long wamask; unsigned long wamask;
XSetWindowAttributes wa; XSetWindowAttributes wa;
@ -139,7 +140,7 @@ static GLboolean createWindow(_GLFWwindow* window,
_glfwGrabXErrorHandler(); _glfwGrabXErrorHandler();
window->x11.handle = XCreateWindow(_glfw.x11.display, window->x11.handle = XCreateWindow(_glfw.x11.display,
_glfw.x11.root, parent ? parent->x11.handle , _glfw.x11.root,
0, 0, 0, 0,
wndconfig->width, wndconfig->height, wndconfig->width, wndconfig->height,
0, // Border width 0, // Border width
@ -936,12 +937,13 @@ unsigned long _glfwGetWindowProperty(Window window,
int _glfwPlatformCreateWindow(_GLFWwindow* window, int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig, const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig) const _GLFWfbconfig* fbconfig,
_GLFWwindow* parent )
{ {
if (!_glfwCreateContext(window, wndconfig, fbconfig)) if (!_glfwCreateContext(window, wndconfig, fbconfig))
return GL_FALSE; return GL_FALSE;
if (!createWindow(window, wndconfig)) if (!createWindow(window, wndconfig, parent))
return GL_FALSE; return GL_FALSE;
if (wndconfig->monitor) if (wndconfig->monitor)