The window’s close callback gets called just fine when I use the window decorations to close it, but if I set a hotkey within the key callback which executes glfwSetWindowShouldClose(window, GLFW_TRUE), the close callback is never executed. This seems inconsistent, and limits the usefulness of the close callback for me. Is this by design?
Verified on 3.2.1 and github master HEAD (efda4afb495be4779c152a96f7b3f52c54cbff32).
I can post a fairly minimal reproducer, if desired.
As documentation says, this function has nothing to do with closing the application, but just set manually the flag “should close” to the windows, then you have to use glfwWindowShouldClose() (in your main loop for example) to know if you have to close or not your program. The close callback is designed for every external call that want to close the window. If you know wich key will end your program just call your close function to that key within the function you pass to glfwSetKeyCallback().