From 68f1b0e248bb7f3d5f0e3806dddc4a0b11defdca Mon Sep 17 00:00:00 2001 From: M374LX Date: Sun, 8 Oct 2023 17:34:28 -0300 Subject: [PATCH] Pass refresh rate if the screen size is the same as the monitor --- src/rcore_desktop.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/rcore_desktop.c b/src/rcore_desktop.c index 07c54d697..f5a7ff6a7 100644 --- a/src/rcore_desktop.c +++ b/src/rcore_desktop.c @@ -358,10 +358,19 @@ void ToggleFullscreen(void) } else { + int monitorWidth = GetMonitorWidth(monitorIndex); + int monitorHeight = GetMonitorHeight(monitorIndex); + int refreshRate = GLFW_DONT_CARE; + + if (CORE.Window.screen.width == monitorWidth && CORE.Window.screen.height == monitorHeight) + { + refreshRate = GetMonitorRefreshRate(refreshRate); + } + CORE.Window.fullscreen = true; CORE.Window.flags |= FLAG_FULLSCREEN_MODE; - glfwSetWindowMonitor(platform.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE); + glfwSetWindowMonitor(platform.handle, monitor, 0, 0, CORE.Window.screen.width, CORE.Window.screen.height, refreshRate); } }