Hello,
On my up-to-date Archlinux system I am developing an OpenGL application in C++ and I am using GLFW for the window creation. For different reasons I would like to disable the cursor with
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
This disables the mouse, makes the "mouse_move_delta" computation easy, etc. My problem is that it makes debugging almost impossible, because when the execution is paused, my cursor is still "lost".
I tried to use the glfwSetWindowFocusCallback() function to "enable" the mouse when focus is lost, but when a breakpoint is hit, this callback is not called.
glfwSetWindowFocusCallback(m_window, [](GLFWwindow* window, int isInFocus)
{
if (isInFocus == GLFW_FALSE)
{
std::cout << "NOT in focus" << std::endl;
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
else
{
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
}
});
I didn't find too much similar questions to mine, one was this: https://github.com/glfw/glfw/issues/530 This says it is not possible to use glfwSetWindowFocusCallback for a case like this. The link proposes a solution, but I don't understand that and I don't think the solution would be to recompile the GLFW...
Now what I do when I would like to debug is to set the cursor to normal (GLFW_CURSOR_NORMAL) recompile and rerun my application, I just don't want to believe this is the way it should be done.
So my question is: is it possible to debug (with enabled mouse cursor etc) when GLFW_CURSOR_DISABLED is used?
Or more general: on other systems (with SDL for example) does debugging with captured mouse work?