Good evening,
I have a problem that isn’t really a bug, but a strange behavior.
Usually when I launch an application from inside Visual Studio and an unhandled exception is thrown, the Visual Studio window is immediately focused and it shows the line that threw the exception.
Now if I initialize a fullscreen window with GLFW on Windows 10 (be it windowed fullscreen or real fullscreen) and an exception is thrown, the Visual Studio window isn’t focused and I can’t change window to see what Visual Studio says. It 's like the fullscreen window is istantly refocused after I try to change window. I can’t even open the Task Manager. The only way to exit from the application is to sign out from the window session and login again.
With a non-fullscreen window the problem doesn’t happen.
Is there any way to get around the problem? I’d like to keep using the comfortable Visual Studio feature that istantly show the origin of unhandled exceptions.
Minimum example (should be compiled an run from Visual Studio 2017):
#include <iostream>
#include <GLFW/glfw3.h>
int main()
{
if (!glfwInit()) { throw std::runtime_error("GLFW initialization failed"); }
glfwSetErrorCallback([](int error, char const* description)
{
std::cout << "GLWF error " << error << ": " << description << std::endl;
});
GLFWwindow * window = glfwCreateWindow(1920, 1080, "GLFW_test", glfwGetPrimaryMonitor(), nullptr);
if (!window) { throw std::runtime_error("Window or OpenGL context creation failed"); }
glfwSetKeyCallback(window,
[](GLFWwindow * window, int key, int scancode, int action, int mods)
{
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
glfwSetWindowShouldClose(window, GLFW_TRUE);
});
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
while (!glfwWindowShouldClose(window))
{
static auto ticks = 0;
++ticks;
if (ticks > 200)
throw std::runtime_error("Test"); // Unhandled exception test
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
}