diff --git a/examples/simple.c b/examples/simple.c index 692fa5b3..7752a365 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -68,12 +68,6 @@ static void error_callback(int error, const char* description) fprintf(stderr, "Error: %s\n", description); } -void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) -{ - if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) - glfwDragWindow(window); -} - static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) @@ -102,7 +96,6 @@ int main(void) } glfwSetKeyCallback(window, key_callback); - glfwSetMouseButtonCallback(window, mouse_button_callback); glfwMakeContextCurrent(window); gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); diff --git a/tests/windows.c b/tests/windows.c index 1c129739..0b94976b 100644 --- a/tests/windows.c +++ b/tests/windows.c @@ -88,6 +88,12 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action, } } +void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) +{ + if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS) + glfwDragWindow(window); +} + int main(int argc, char** argv) { int i, ch; @@ -131,6 +137,7 @@ int main(int argc, char** argv) } glfwSetKeyCallback(windows[i], key_callback); + glfwSetMouseButtonCallback(windows[i], mouse_button_callback); glfwMakeContextCurrent(windows[i]); gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);