Skip to content

Commit fbdf5e4

Browse files
authored
fix(rcore): correctly scale content on macOS (#5186)
Currently, scaling doesn't work correctly on macOS (see #5185). This commit works around this issue by disabling SCALE_FRAMEBUFFER on macOS when `FLAG_WINDOW_HIGHDPI` is unset.
1 parent ed8f1a2 commit fbdf5e4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/platforms/rcore_desktop_glfw.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,10 +1428,18 @@ int InitPlatform(void)
14281428
// was enabled by default. Disabling it gets back the old behavior. A
14291429
// complete fix will require removing a lot of CORE.Window.render
14301430
// manipulation code
1431-
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
1431+
// NOTE: This currently doesn't work on macOS(see #5185), so we skip it there
1432+
// when FLAG_WINDOW_HIGHDPI is *unset*
1433+
#if !defined(__APPLE__)
1434+
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
1435+
#endif
14321436

14331437
if ((CORE.Window.flags & FLAG_WINDOW_HIGHDPI) > 0)
14341438
{
1439+
// since we skipped it before, now make sure to set this on macOS
1440+
#if defined(__APPLE__)
1441+
glfwWindowHint(GLFW_SCALE_FRAMEBUFFER, GLFW_FALSE);
1442+
#endif
14351443
// Resize window content area based on the monitor content scale
14361444
// NOTE: This hint only has an effect on platforms where screen coordinates and pixels always map 1:1 such as Windows and X11
14371445
// On platforms like macOS the resolution of the framebuffer is changed independently of the window size

0 commit comments

Comments
 (0)