From d0b7f539e20aaff40bdc1a166f115b3b9f6497bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 10 Apr 2019 21:37:44 +0200 Subject: [PATCH] Add full screen toggling to cursor test --- tests/cursor.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/cursor.c b/tests/cursor.c index c5ca0a0c..3edadf02 100644 --- a/tests/cursor.c +++ b/tests/cursor.c @@ -292,6 +292,31 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, case GLFW_KEY_6: glfwSetCursor(window, standard_cursors[5]); break; + + case GLFW_KEY_F11: + case GLFW_KEY_ENTER: + { + static int x, y, width, height; + + if (mods != GLFW_MOD_ALT) + return; + + if (glfwGetWindowMonitor(window)) + glfwSetWindowMonitor(window, NULL, x, y, width, height, 0); + else + { + GLFWmonitor* monitor = glfwGetPrimaryMonitor(); + const GLFWvidmode* mode = glfwGetVideoMode(monitor); + glfwGetWindowPos(window, &x, &y); + glfwGetWindowSize(window, &width, &height); + glfwSetWindowMonitor(window, monitor, + 0, 0, mode->width, mode->height, + mode->refreshRate); + } + + glfwGetCursorPos(window, &cursor_x, &cursor_y); + break; + } } }