Merge branch 'showwindow'

This commit is contained in:
Camilla Berglund
2012-09-11 20:03:55 +02:00
9 changed files with 172 additions and 112 deletions
+55 -3
View File
@@ -80,8 +80,9 @@ void _glfwSetDefaultWindowHints(void)
_glfwLibrary.hints.glMajor = 1;
_glfwLibrary.hints.glMinor = 0;
// The default is to allow window resizing
// The default is to show the window and allow window resizing
_glfwLibrary.hints.resizable = GL_TRUE;
_glfwLibrary.hints.visible = GL_TRUE;
// The default is 24 bits of depth, 8 bits of color
_glfwLibrary.hints.depthBits = 24;
@@ -180,6 +181,16 @@ void _glfwInputWindowIconify(_GLFWwindow* window, int iconified)
}
//========================================================================
// Register window visibility events
//========================================================================
void _glfwInputWindowVisibility(_GLFWwindow* window, int visible)
{
window->visible = visible;
}
//========================================================================
// Register window damage events
//========================================================================
@@ -250,6 +261,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
wndconfig.title = title;
wndconfig.refreshRate = Max(_glfwLibrary.hints.refreshRate, 0);
wndconfig.resizable = _glfwLibrary.hints.resizable ? GL_TRUE : GL_FALSE;
wndconfig.visible = _glfwLibrary.hints.visible ? GL_TRUE : GL_FALSE;
wndconfig.glMajor = _glfwLibrary.hints.glMajor;
wndconfig.glMinor = _glfwLibrary.hints.glMinor;
wndconfig.glForward = _glfwLibrary.hints.glForward ? GL_TRUE : GL_FALSE;
@@ -354,6 +366,9 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height,
glClear(GL_COLOR_BUFFER_BIT);
_glfwPlatformSwapBuffers(window);
if (wndconfig.visible)
glfwShowWindow(window);
return window;
}
@@ -411,9 +426,12 @@ GLFWAPI void glfwWindowHint(int target, int hint)
case GLFW_STEREO:
_glfwLibrary.hints.stereo = hint;
break;
case GLFW_WINDOW_RESIZABLE:
case GLFW_RESIZABLE:
_glfwLibrary.hints.resizable = hint;
break;
case GLFW_VISIBLE:
_glfwLibrary.hints.visible = hint;
break;
case GLFW_FSAA_SAMPLES:
_glfwLibrary.hints.samples = hint;
break;
@@ -627,6 +645,38 @@ GLFWAPI void glfwIconifyWindow(GLFWwindow handle)
}
//========================================================================
// Window show
//========================================================================
GLFWAPI void glfwShowWindow(GLFWwindow window)
{
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
_glfwPlatformShowWindow((_GLFWwindow*)window);
}
//========================================================================
// Window hide
//========================================================================
GLFWAPI void glfwHideWindow(GLFWwindow window)
{
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED, NULL);
return;
}
_glfwPlatformHideWindow((_GLFWwindow*)window);
}
//========================================================================
// Window un-iconification
//========================================================================
@@ -675,8 +725,10 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window->closeRequested;
case GLFW_REFRESH_RATE:
return window->refreshRate;
case GLFW_WINDOW_RESIZABLE:
case GLFW_RESIZABLE:
return window->resizable;
case GLFW_VISIBLE:
return window->visible;
case GLFW_OPENGL_VERSION_MAJOR:
return window->glMajor;
case GLFW_OPENGL_VERSION_MINOR: