2 Commits

Author SHA1 Message Date
Ray
260d270c58 Update rcore_desktop_glfw.c 2026-09-17 20:46:02 +02:00
bdf10f516c [rcore][GLFW] Fixed issue with non-fullscreen window being able to be larger than a workable area (#6137)
* Fixed issue with non-fullscreen window being able to be larger than a workable area

GLFW has a problem where if the window is greater than the workable area (this means
the taskbar / dockable areas) it won't show up if the window isn't fullscreen. This fix clamps the size of the window to that maximum workable area

* Aligned pointer convention
2026-09-17 20:42:06 +02:00

View File

@ -1615,10 +1615,6 @@ int InitPlatform(void)
if ((CORE.Window.screen.width == 0) || (CORE.Window.screen.height == 0)) FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE); if ((CORE.Window.screen.width == 0) || (CORE.Window.screen.height == 0)) FLAG_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE);
// Init window in fullscreen mode if requested
// NOTE: Keeping original screen size for toggle
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
{
// NOTE: Fullscreen applications default to the primary monitor // NOTE: Fullscreen applications default to the primary monitor
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); GLFWmonitor *monitor = glfwGetPrimaryMonitor();
if (!monitor) if (!monitor)
@ -1627,6 +1623,10 @@ int InitPlatform(void)
return -1; return -1;
} }
// Init window in fullscreen mode if requested
// NOTE: Keeping original screen size for toggle
if (FLAG_IS_SET(CORE.Window.flags, FLAG_FULLSCREEN_MODE))
{
// Set dimensions from monitor // Set dimensions from monitor
const GLFWvidmode *mode = glfwGetVideoMode(monitor); const GLFWvidmode *mode = glfwGetVideoMode(monitor);
@ -1667,6 +1667,18 @@ int InitPlatform(void)
if (CORE.Window.screen.width == 0) CORE.Window.screen.width = 1; if (CORE.Window.screen.width == 0) CORE.Window.screen.width = 1;
if (CORE.Window.screen.height == 0) CORE.Window.screen.height = 1; if (CORE.Window.screen.height == 0) CORE.Window.screen.height = 1;
int workX = 0;
int workY = 0;
int workWidth = 0;
int workHeight = 0;
glfwGetMonitorWorkarea(monitor, &workX, &workY, &workWidth, &workHeight);
// If the area requested by the user exceeds the maximum workable area, clamp it to that
// GLFW has a problem where if the window is greater than the workable area (this means
// the taskbar / dockable areas) it won't show up if the window isn't fullscreen
if (CORE.Window.screen.width > workWidth) CORE.Window.screen.width = workWidth;
if (CORE.Window.screen.height > workHeight) CORE.Window.screen.height = workHeight;
platform.handle = glfwCreateWindow(CORE.Window.screen.width, CORE.Window.screen.height, (CORE.Window.title != 0)? CORE.Window.title : " ", NULL, NULL); platform.handle = glfwCreateWindow(CORE.Window.screen.width, CORE.Window.screen.height, (CORE.Window.title != 0)? CORE.Window.title : " ", NULL, NULL);
if (!platform.handle) if (!platform.handle)
{ {