Skip to content

Commit 5c954c1

Browse files
authored
Merge pull request #4909 from gfaster/alt_fix
Revert GLFW_SCALE_FRAMEBUFFER to pre GLFW 4.3 behavior
2 parents 7c6537a + 10478ff commit 5c954c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/platforms/rcore_desktop_glfw.c

+8-2
Original file line numberDiff line numberDiff line change
@@ -1381,14 +1381,20 @@ int InitPlatform(void)
13811381
if ((CORE.Window.flags & FLAG_WINDOW_TRANSPARENT) > 0) glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_TRUE); // Transparent framebuffer
13821382
else glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, GLFW_FALSE); // Opaque framebuffer
13831383

1384+
// HACK: Most of this was written before GLFW_SCALE_FRAMEBUFFER existed and
1385+
// was enabled by default. Disabling it gets back the old behavior. A
1386+
// complete fix will require removing a lot of CORE.Window.render
1387+
// manipulation code.
1388+
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
1389+
13841390
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
13851391
{
13861392
// Resize window content area based on the monitor content scale.
13871393
// NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11.
13881394
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size.
13891395
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); // Scale content area based on the monitor content scale where window is placed on
13901396
#if defined(__APPLE__)
1391-
glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE);
1397+
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
13921398
#endif
13931399
}
13941400
else glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_FALSE);
@@ -1602,7 +1608,7 @@ int InitPlatform(void)
16021608
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
16031609
{
16041610
// NOTE: On APPLE platforms system should manage window/input scaling and also framebuffer scaling.
1605-
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GLFW_TRUE);
1611+
// Framebuffer scaling should be activated with: glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_TRUE);
16061612
#if !defined(__APPLE__)
16071613
glfwGetFramebufferSize(platform.handle, &fbWidth, &fbHeight);
16081614

0 commit comments

Comments
 (0)