This commit is contained in:
sagaceilo 2013-11-11 03:27:43 -08:00
commit 5e9117bad2
6 changed files with 29 additions and 18 deletions

View File

@ -1230,6 +1230,9 @@ GLFWAPI void glfwWindowHint(int target, int hint);
* windowed mode.
* @param[in] share The window whose context to share resources with, or `NULL`
* to not share resources.
* @param[in] make this window parent to new one, new window will be always on top another. Pass `NULL`
* to not make new window a child one.
* @return The handle of the created window, or `NULL` if an error occurred.
*
* @remarks **Windows:** Window creation will fail if the Microsoft GDI
@ -1258,7 +1261,7 @@ GLFWAPI void glfwWindowHint(int target, int hint);
*
* @ingroup window
*/
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share, GLFWwindow* parent);
/*! @brief Destroys the specified window and its context.
*

View File

@ -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];

View File

@ -453,7 +453,8 @@ void _glfwPlatformSetTime(double time);
*/
int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig);
const _GLFWfbconfig* fbconfig,
_GLFWwindow* parent);
/*! @ingroup platform
*/

View File

@ -789,7 +789,8 @@ static ATOM registerWindowClass(void)
//
static int createWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
const _GLFWfbconfig* fbconfig,
_GLFWwindow* parent )
{
int xpos, ypos, fullWidth, fullHeight;
WCHAR* wideTitle;
@ -842,7 +843,7 @@ static int createWindow(_GLFWwindow* window,
window->win32.dwStyle,
xpos, ypos,
fullWidth, fullHeight,
NULL, // No parent window
parent ? parent->win32.handle : NULL, // No parent window
NULL, // No window menu
GetModuleHandle(NULL),
window); // Pass object to WM_CREATE
@ -881,7 +882,8 @@ static void destroyWindow(_GLFWwindow* window)
int _glfwPlatformCreateWindow(_GLFWwindow* window,
const _GLFWwndconfig* wndconfig,
const _GLFWfbconfig* fbconfig)
const _GLFWfbconfig* fbconfig,
_GLFWwindow* parent)
{
int status;
@ -892,7 +894,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
return GL_FALSE;
}
if (!createWindow(window, wndconfig, fbconfig))
if (!createWindow(window, wndconfig, fbconfig, parent ))
return GL_FALSE;
status = _glfwAnalyzeContext(window, wndconfig, fbconfig);
@ -927,7 +929,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
destroyWindow(window);
// ...and then create them again, this time with better APIs
if (!createWindow(window, wndconfig, fbconfig))
if (!createWindow(window, wndconfig, fbconfig, parent))
return GL_FALSE;
}

View File

@ -143,12 +143,13 @@ void _glfwInputWindowCloseRequest(_GLFWwindow* window)
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
const char* title,
GLFWmonitor* monitor,
GLFWwindow* share)
GLFWwindow* share,
GLFWwindow* parent )
{
_GLFWfbconfig fbconfig;
_GLFWwndconfig wndconfig;
_GLFWwindow* window;
_GLFWwindow* previous;
_GLFWwindow* window = NULL;
_GLFWwindow* previous = NULL;
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
@ -222,7 +223,7 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height,
previous = (_GLFWwindow*) glfwGetCurrentContext();
// Open the actual window and create its context
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig))
if (!_glfwPlatformCreateWindow(window, &wndconfig, &fbconfig, (_GLFWwindow*)parent ))
{
glfwDestroyWindow((GLFWwindow*) window);
glfwMakeContextCurrent((GLFWwindow*) previous);

View File

@ -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)