Replaced automatic closing with window parameter.

This commit is contained in:
Camilla Berglund
2012-08-10 13:31:15 +02:00
parent 2212cd94bf
commit 2410e2aaf4
21 changed files with 53 additions and 112 deletions
+15 -29
View File
@@ -44,31 +44,6 @@ static int Max(int a, int b)
}
//========================================================================
// Close all GLFW windows with the closed flag set
//========================================================================
static void closeFlaggedWindows(void)
{
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; )
{
if (window->closeRequested && _glfwLibrary.windowCloseCallback)
window->closeRequested = _glfwLibrary.windowCloseCallback(window);
if (window->closeRequested)
{
_GLFWwindow* next = window->next;
glfwDestroyWindow(window);
window = next;
}
else
window = window->next;
}
}
//========================================================================
// Clear scroll offsets for all windows
//========================================================================
@@ -206,6 +181,19 @@ void _glfwInputWindowDamage(_GLFWwindow* window)
}
//========================================================================
// Register window close request events
//========================================================================
void _glfwInputWindowCloseRequest(_GLFWwindow* window)
{
if (_glfwLibrary.windowCloseCallback)
window->closeRequested = _glfwLibrary.windowCloseCallback(window);
else
window->closeRequested = GL_TRUE;
}
//////////////////////////////////////////////////////////////////////////
////// GLFW public API //////
//////////////////////////////////////////////////////////////////////////
@@ -662,6 +650,8 @@ GLFWAPI int glfwGetWindowParam(GLFWwindow handle, int param)
return window == _glfwLibrary.activeWindow;
case GLFW_ICONIFIED:
return window->iconified;
case GLFW_CLOSE_REQUESTED:
return window->closeRequested;
case GLFW_REFRESH_RATE:
return window->refreshRate;
case GLFW_WINDOW_RESIZABLE:
@@ -818,8 +808,6 @@ GLFWAPI void glfwPollEvents(void)
clearScrollOffsets();
_glfwPlatformPollEvents();
closeFlaggedWindows();
}
@@ -838,7 +826,5 @@ GLFWAPI void glfwWaitEvents(void)
clearScrollOffsets();
_glfwPlatformWaitEvents();
closeFlaggedWindows();
}