From 5159cfc2b08f752f4e2de227b8da9b44fa23e457 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 7 Feb 2012 16:40:26 +0100 Subject: [PATCH] Added window close control. --- tests/events.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/events.c b/tests/events.c index fffd9f58..e43c52ea 100644 --- a/tests/events.c +++ b/tests/events.c @@ -42,6 +42,7 @@ static GLboolean keyrepeat = 0; static GLboolean systemkeys = 1; +static GLboolean closeable = 1; static unsigned int counter = 0; static const char* get_key_name(int key) @@ -230,7 +231,7 @@ 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()); - return 1; + return closeable; } static void window_refresh_callback(GLFWwindow window) @@ -312,6 +313,14 @@ static void key_callback(GLFWwindow window, int key, int action) printf("(( system keys %s ))\n", systemkeys ? "enabled" : "disabled"); break; } + + case GLFW_KEY_C: + { + closeable = !closeable; + + printf("(( closing %s ))\n", closeable ? "enabled" : "disabled"); + break; + } } }