mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-19 01:38:14 +00:00
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.
This commit is contained in:
12
src/core.c
12
src/core.c
@@ -933,8 +933,9 @@ void SetWindowMonitor(int monitor)
|
|||||||
|
|
||||||
if ((monitor >= 0) && (monitor < monitorCount))
|
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]));
|
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");
|
else TraceLog(LOG_WARNING, "Selected monitor not found");
|
||||||
#endif
|
#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);
|
TraceLog(LOG_WARNING, "Closest fullscreen videomode: %i x %i", displayWidth, displayHeight);
|
||||||
|
|
||||||
// NOTE: ISSUE: Closest videomode could not match monitor aspect-ratio, for example,
|
// NOTE: ISSUE: Closest videomode could not match monitor aspect-ratio, for example,
|
||||||
|
Reference in New Issue
Block a user