From fcedb0be325425a6ad16d53349f2008ac4fc05d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Thu, 26 Oct 2017 18:52:43 +0200 Subject: [PATCH] Fix windows not detaching on monitor disconnect Regression introduced by 04f559e28d02f621187a0631490f26527cee8b81. Related to #1106. --- src/monitor.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/monitor.c b/src/monitor.c index 40b24132..0dfb1958 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -107,6 +107,17 @@ void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement) else if (action == GLFW_DISCONNECTED) { int i; + _GLFWwindow* window; + + for (window = _glfw.windowListHead; window; window = window->next) + { + if (window->monitor == monitor) + { + int width, height; + _glfwPlatformGetWindowSize(window, &width, &height); + _glfwPlatformSetWindowMonitor(window, NULL, 0, 0, width, height, 0); + } + } for (i = 0; i < _glfw.monitorCount; i++) {