mirror of
https://github.com/glfw/glfw.git
synced 2024-11-10 00:51:47 +00:00
Moved window close check to shared code.
This commit is contained in:
parent
0ba1cf9c59
commit
c6bd6a7741
19
src/window.c
19
src/window.c
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user