summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorJustin <[email protected]>2019-12-09 15:14:56 -0800
committerRay <[email protected]>2019-12-10 00:14:56 +0100
commit7eacac24d53aba1443d54eaa2fd1958bca37dc52 (patch)
treec8f7380e959451f8b67d51a87a92fbb492659353 /src/core.c
parent2a64aa2abdb1ee907082f7c09caf7888f120ce45 (diff)
downloadraylib-7eacac24d53aba1443d54eaa2fd1958bca37dc52.tar.gz
raylib-7eacac24d53aba1443d54eaa2fd1958bca37dc52.zip
SetWindowMonitor made functioning again. (#1036)
* We get the video mode from the target monitor and use that to set, therefore keeping windowed-fullscreen * Added a GLFW_AUTO_ICONIFY 0 hint so that glfw does not minimize the window when changing focus from a windowed fullscreen window. This is more expected behavior for windowed full screen, when a user alt-tabs or clicks on a window in the other monitor, they expect their windowed-fullscreen window to remaining up.
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index e3303417..739d54dd 100644
--- a/src/core.c
+++ b/src/core.c
@@ -933,8 +933,9 @@ void SetWindowMonitor(int monitor)
if ((monitor >= 0) && (monitor < monitorCount))
{
- //glfwSetWindowMonitor(window, monitors[monitor], 0, 0, screenWidth, screenHeight, GLFW_DONT_CARE);
TraceLog(LOG_INFO, "Selected fullscreen monitor: [%i] %s", monitor, glfwGetMonitorName(monitors[monitor]));
+ const GLFWvidmode* mode = glfwGetVideoMode(monitors[monitor]);
+ glfwSetWindowMonitor(window, monitors[monitor], 0, 0, mode->width, mode->height, mode->refreshRate);
}
else TraceLog(LOG_WARNING, "Selected monitor not found");
#endif
@@ -2743,6 +2744,15 @@ static bool InitGraphicsDevice(int width, int height)
}
}
+#if defined(PLATFORM_DESKTOP)
+ // If we are windowed fullscreen, ensures that window does not minimize
+ // when focus is lost.
+ if (screenHeight == displayHeight && screenWidth == displayWidth)
+ {
+ glfwWindowHint(GLFW_AUTO_ICONIFY, 0);
+ }
+#endif
+
TraceLog(LOG_WARNING, "Closest fullscreen videomode: %i x %i", displayWidth, displayHeight);
// NOTE: ISSUE: Closest videomode could not match monitor aspect-ratio, for example,