Skip to content

Commit 6727062

Browse files
committed
[rcore][GLFW] call glfwSetWindowAttrib() after glfwSetWindowMonitor()
for some reason when glfwSetWindowAttrib() is called it changes the value in `CORE.Window.previousScreen`, it causes the window to no resize into the orginal size after minimizing the window logs: INFO: SHADER: [ID 1] Vertex shader compiled successfully INFO: SHADER: [ID 2] Fragment shader compiled successfully INFO: SHADER: [ID 3] Program shader loaded successfully INFO: SHADER: [ID 3] Default shader loaded successfully INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU) INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU) INFO: RLGL: Default OpenGL state initialized successfully INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps) INFO: FONT: Default font loaded successfully (224 glyphs) INFO: SYSTEM: Working Directory: D:\Projects\tmp\raylib\src INFO:[TEST] Height: 500, Width: 900 <- after CORE.Window.screen = CORE.Window.previousScreen INFO:[TEST] Height: 1061, Width: 1920 <- after glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE) if we clear the flags after we call glfwSetWindowMonitor() the window size stays correct Signed-off-by: tillua467 <tillua467@gmail.com>
1 parent 050042b commit 6727062

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/platforms/rcore_desktop_glfw.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,6 @@ void ToggleBorderlessWindowed(void)
301301
CORE.Window.position = CORE.Window.previousPosition;
302302
CORE.Window.screen = CORE.Window.previousScreen;
303303

304-
// Remove undecorated flag
305-
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
306-
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
307-
308304
#if !defined(__APPLE__) && !defined(_GLFW_WAYLAND)
309305
// Make sure to restore size considering HighDPI scaling
310306
// NOTE: On Wayland, GLFW_SCALE_FRAMEBUFFER handles scaling, skip manual resize
@@ -320,6 +316,10 @@ void ToggleBorderlessWindowed(void)
320316
glfwSetWindowMonitor(platform.handle, NULL, CORE.Window.position.x, CORE.Window.position.y,
321317
CORE.Window.screen.width, CORE.Window.screen.height, GLFW_DONT_CARE);
322318

319+
// Remove undecorated flag
320+
glfwSetWindowAttrib(platform.handle, GLFW_DECORATED, GLFW_TRUE);
321+
FLAG_CLEAR(CORE.Window.flags, FLAG_WINDOW_UNDECORATED);
322+
323323
// Refocus window
324324
glfwFocusWindow(platform.handle);
325325

0 commit comments

Comments
 (0)