From 5f4e66b21a4930be419b2f4df666415e97424d2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Wed, 10 Apr 2019 19:06:47 +0200 Subject: [PATCH] Add cursor position rountrip key to cursor test Related to #1461. --- tests/cursor.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/cursor.c b/tests/cursor.c index 0e6faea0..a72c14e3 100644 --- a/tests/cursor.c +++ b/tests/cursor.c @@ -231,6 +231,26 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, break; + case GLFW_KEY_P: + { + double x, y; + glfwGetCursorPos(window, &x, &y); + + printf("Query before set: %f %f (%+f %+f)\n", + x, y, x - cursor_x, y - cursor_y); + cursor_x = x; + cursor_y = y; + + glfwSetCursorPos(window, cursor_x, cursor_y); + glfwGetCursorPos(window, &x, &y); + + printf("Query after set: %f %f (%+f %+f)\n", + x, y, x - cursor_x, y - cursor_y); + cursor_x = x; + cursor_y = y; + break; + } + case GLFW_KEY_0: glfwSetCursor(window, NULL); break;