Moved window close check to shared code.

This commit is contained in:
Camilla Berglund 2010-09-13 23:25:55 +02:00
parent 0ba1cf9c59
commit c6bd6a7741
2 changed files with 18 additions and 16 deletions

View File

@ -1039,11 +1039,13 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfu
//========================================================================
// Poll for new window and input events
// Poll for new window and input events and close any flagged windows
//========================================================================
GLFWAPI void glfwPollEvents(void)
{
_GLFWwindow* window;
if (!_glfwInitialized)
{
_glfwSetError(GLFW_NOT_INITIALIZED);
@ -1051,6 +1053,21 @@ GLFWAPI void glfwPollEvents(void)
}
_glfwPlatformPollEvents();
for (window = _glfwLibrary.windowListHead; window; )
{
if (window->closed && window->windowCloseCallback)
window->closed = window->windowCloseCallback(window);
if (window->closed)
{
_GLFWwindow* next = window->next;
glfwCloseWindow(window);
window = next;
}
else
window = window->next;
}
}

View File

@ -1756,21 +1756,6 @@ void _glfwPlatformPollEvents(void)
window->height / 2);
}
}
for (window = _glfwLibrary.windowListHead; window; )
{
if (window->closed && window->windowCloseCallback)
window->closed = window->windowCloseCallback(window);
if (window->closed)
{
_GLFWwindow* next = window->next;
glfwCloseWindow(window);
window = next;
}
else
window = window->next;
}
}