From 3216661da7d93f1cc4e4f7410c3c9a608379e846 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 7 Aug 2012 21:40:40 +0200 Subject: [PATCH] Removed ill-advised use of glfwGetCurrentContext. --- tests/events.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/events.c b/tests/events.c index e9b7b7d2..bd8b1546 100644 --- a/tests/events.c +++ b/tests/events.c @@ -40,11 +40,17 @@ #include #include +// These must match the input mode defaults static GLboolean keyrepeat = GL_FALSE; static GLboolean systemkeys = GL_TRUE; static GLboolean closeable = GL_TRUE; + +// Event index static unsigned int counter = 0; +// Should we keep running? +static GLboolean running = GL_TRUE; + static const char* get_key_name(int key) { switch (key) @@ -231,6 +237,10 @@ static void window_size_callback(GLFWwindow window, int width, int height) static int window_close_callback(GLFWwindow window) { printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime()); + + if (closeable) + running = GL_FALSE; + return closeable; } @@ -389,7 +399,7 @@ int main(void) printf("Main loop starting\n"); - while (glfwGetCurrentContext()) + while (running) glfwWaitEvents(); glfwTerminate();