Skip to content

Commit 78a81bf

Browse files
authored
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
1 parent 9445676 commit 78a81bf

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/platforms/rcore_desktop_glfw.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,15 @@ void ToggleBorderlessWindowed(void)
265265
const int monitorHeight = mode->height;
266266

267267
// Set screen position and size
268-
glfwSetWindowPos(platform.handle, monitorPosX, monitorPosY);
269-
glfwSetWindowSize(platform.handle, monitorWidth, monitorHeight);
268+
glfwSetWindowMonitor(
269+
platform.handle,
270+
monitors[monitor],
271+
monitorPosX,
272+
monitorPosY,
273+
monitorWidth,
274+
monitorHeight,
275+
mode->refreshRate
276+
);
270277

271278
// Refocus window
272279
glfwFocusWindow(platform.handle);
@@ -281,8 +288,15 @@ void ToggleBorderlessWindowed(void)
281288

282289
// Return previous screen size and position
283290
// NOTE: The order matters here, it must set size first, then set position, otherwise the screen will be positioned incorrectly
284-
glfwSetWindowSize(platform.handle, CORE.Window.previousScreen.width, CORE.Window.previousScreen.height);
285-
glfwSetWindowPos(platform.handle, CORE.Window.previousPosition.x, CORE.Window.previousPosition.y);
291+
glfwSetWindowMonitor(
292+
platform.handle,
293+
NULL,
294+
CORE.Window.previousPosition.x,
295+
CORE.Window.previousPosition.y,
296+
CORE.Window.previousScreen.width,
297+
CORE.Window.previousScreen.height,
298+
mode->refreshRate
299+
);
286300

287301
// Refocus window
288302
glfwFocusWindow(platform.handle);

0 commit comments

Comments
 (0)