From 770daa19c88603cd287cc23b0fb1b3b0d8f41c62 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 7 Jun 2013 15:11:26 +0200 Subject: [PATCH] Avoid mode re-enumeration, take two. --- src/monitor.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/monitor.c b/src/monitor.c index 7ec1bba7..7a70676e 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -79,6 +79,9 @@ static int refreshVideoModes(_GLFWmonitor* monitor) { int modeCount; + if (monitor->modes) + return GL_TRUE; + GLFWvidmode* modes = _glfwPlatformGetVideoModes(monitor, &modeCount); if (!modes) return GL_FALSE; @@ -340,11 +343,8 @@ GLFWAPI const GLFWvidmode* glfwGetVideoModes(GLFWmonitor* handle, int* count) _GLFW_REQUIRE_INIT_OR_RETURN(NULL); - if (monitor->modes == NULL) - { - if (!refreshVideoModes(monitor)) - return GL_FALSE; - } + if (!refreshVideoModes(monitor)) + return NULL; *count = monitor->modeCount; return monitor->modes;