Fix ToggleBorderlessFullscreen() Not Hiding Taskbar (#5383)

* Use glfwSetWindowMonitor instead of Pos and Size GLFW functions

* Fix window not resetting properly when toggling out of fullscreen, formatting
This commit is contained in:
Aly 2025-12-02 13:55:22 -08:00 committed by GitHub
parent 944567651c
commit 78a81bf407
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -265,8 +265,15 @@ void ToggleBorderlessWindowed(void)
const int monitorHeight = mode->height; const int monitorHeight = mode->height;
// Set screen position and size // Set screen position and size
glfwSetWindowPos(platform.handle, monitorPosX, monitorPosY); glfwSetWindowMonitor(
glfwSetWindowSize(platform.handle, monitorWidth, monitorHeight); platform.handle,
monitors[monitor],
monitorPosX,
monitorPosY,
monitorWidth,
monitorHeight,
mode->refreshRate
);
// Refocus window // Refocus window
glfwFocusWindow(platform.handle); glfwFocusWindow(platform.handle);
@ -281,8 +288,15 @@ void ToggleBorderlessWindowed(void)
// Return previous screen size and position // Return previous screen size and position
// NOTE: The order matters here, it must set size first, then set position, otherwise the screen will be positioned incorrectly // NOTE: The order matters here, it must set size first, then set position, otherwise the screen will be positioned incorrectly
glfwSetWindowSize(platform.handle, CORE.Window.previousScreen.width, CORE.Window.previousScreen.height); glfwSetWindowMonitor(
glfwSetWindowPos(platform.handle, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y); platform.handle,
NULL,
CORE.Window.previousPosition.x,
CORE.Window.previousPosition.y,
CORE.Window.previousScreen.width,
CORE.Window.previousScreen.height,
mode->refreshRate
);
// Refocus window // Refocus window
glfwFocusWindow(platform.handle); glfwFocusWindow(platform.handle);