raylib/src
paddy 4678a544b6
[rcore][glfw] Fix window scaling on Wayland with GLFW 3.4+ (#5564)
* Fix window scaling on Wayland with GLFW 3.4+ display scaling

GLFW 3.4 defaults GLFW_SCALE_FRAMEBUFFER to TRUE on all platforms,
causing framebuffer/window size mismatch on Wayland with display
scaling (content renders in a subset of the window, mouse coordinates
are wrong).

Three fixes:
- Disable GLFW_SCALE_FRAMEBUFFER on Wayland when FLAG_WINDOW_HIGHDPI
  is not set, restoring 1:1 window-to-framebuffer mapping
- With FLAG_WINDOW_HIGHDPI, read actual framebuffer size from GLFW
  instead of resizing the window (which double-scales on Wayland
  where GLFW_SCALE_TO_MONITOR has no effect)
- Skip mouse coordinate scaling on Wayland since GLFW already reports
  coordinates in logical (window) space

Tested on NixOS/Niri with GLFW 3.4 at 1x, 1.5x, and 2x scaling.

Fixes #5504

* Fix fullscreen and borderless windowed scaling on Wayland with HiDPI

ToggleFullscreen and ToggleBorderlessWindowed exit paths manually
scale screen size by DPI before passing to glfwSetWindowMonitor,
which double-scales on Wayland where GLFW_SCALE_FRAMEBUFFER already
handles it. Skip the manual resize on Wayland.

Also fix FramebufferSizeCallback fullscreen branch: on Wayland with
GLFW_SCALE_FRAMEBUFFER the framebuffer is still scaled in fullscreen,
so use the logical window size as screen size and derive screenScale
from the framebuffer/window ratio.

Fixes #5504

* Apply style fixes from code review: remove duplicate screenScale assignment, collapse single-statement ifs to one line, remove trailing periods from comments
2026-02-17 12:43:52 +01:00
..
external Update win32_clipboard.h 2026-02-12 19:08:48 +01:00
platforms [rcore][glfw] Fix window scaling on Wayland with GLFW 3.4+ (#5564) 2026-02-17 12:43:52 +01:00
CMakeLists.txt Update CMakeLists.txt 2026-01-10 12:20:26 +01:00
config.h REVIEWED: EXTERNAL_CONFIG_FLAGS usage, check moved to config.h 2026-01-12 13:04:38 +01:00
Makefile REVIEWED: Installed libraries #5550 2026-02-14 22:17:49 +01:00
minshell.html Update minshell.html 2025-12-30 22:05:37 +01:00
raudio.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
raylib.dll.rc Update year to 2025 2025-01-01 00:02:52 +01:00
raylib.dll.rc.data Update year to 2025 2025-01-01 00:02:52 +01:00
raylib.h Update raylib.h 2026-02-12 18:55:42 +01:00
raylib.ico Update raylib.ico 2024-11-14 16:40:04 +01:00
raylib.rc Update year to 2025 2025-01-01 00:02:52 +01:00
raylib.rc.data Update year to 2025 2025-01-01 00:02:52 +01:00
raymath.h raymath: wrap float3 and float16 for consistency with other types (#5540) 2026-02-10 00:05:35 +01:00
rcamera.h update camera pan speed (#5554) 2026-02-14 22:16:09 +01:00
rcore.c Init framebuffer using render size (should be same as currentFbo) 2026-02-17 12:13:04 +01:00
rgestures.h Update year to 2026 2026-01-02 13:40:15 +01:00
rglfw.c Update year to 2026 2026-01-02 13:40:15 +01:00
rlgl.h REVIEWED: Comments 2026-02-09 22:23:23 +01:00
rmodels.c Fixed doesn't property load when 1 frame animation. (#5561) 2026-02-15 20:15:25 +01:00
rshapes.c REVIEWED: CheckCollisionLines(), formating and follow raylib conventions 2026-02-06 10:55:42 +01:00
rtext.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
rtextures.c REVIEWED: GetImageColor() #5560 2026-02-14 22:22:31 +01:00
shell.html fix (#5482) 2026-01-09 23:09:06 +01:00