Moved flagged window closing into a separate function.
This commit is contained in:
parent
d874f7ac98
commit
5a8dcead1e
45
src/window.c
45
src/window.c
@ -44,6 +44,32 @@ static int Max(int a, int b)
|
|||||||
return (a > b) ? a : b;
|
return (a > b) ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================
|
||||||
|
// Close all GLFW windows with the closed flag set
|
||||||
|
//========================================================================
|
||||||
|
|
||||||
|
static void closeFlaggedWindows(void)
|
||||||
|
{
|
||||||
|
_GLFWwindow* window;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
////// GLFW internal API //////
|
////// GLFW internal API //////
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -1044,8 +1070,6 @@ GLFWAPI void glfwSetWindowRefreshCallback(GLFWwindow window, GLFWwindowrefreshfu
|
|||||||
|
|
||||||
GLFWAPI void glfwPollEvents(void)
|
GLFWAPI void glfwPollEvents(void)
|
||||||
{
|
{
|
||||||
_GLFWwindow* window;
|
|
||||||
|
|
||||||
if (!_glfwInitialized)
|
if (!_glfwInitialized)
|
||||||
{
|
{
|
||||||
_glfwSetError(GLFW_NOT_INITIALIZED);
|
_glfwSetError(GLFW_NOT_INITIALIZED);
|
||||||
@ -1054,20 +1078,7 @@ GLFWAPI void glfwPollEvents(void)
|
|||||||
|
|
||||||
_glfwPlatformPollEvents();
|
_glfwPlatformPollEvents();
|
||||||
|
|
||||||
for (window = _glfwLibrary.windowListHead; window; )
|
closeFlaggedWindows();
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1084,5 +1095,7 @@ GLFWAPI void glfwWaitEvents(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_glfwPlatformWaitEvents();
|
_glfwPlatformWaitEvents();
|
||||||
|
|
||||||
|
closeFlaggedWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user