raylib/src/platforms
Repository files (latest commit first)
Filename Latest commit message Latest commit date
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
..
rcore_android.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
rcore_desktop_glfw.c [rcore][glfw] Fix window scaling on Wayland with GLFW 3.4+ (#5564) 2026-02-17 12:43:52 +01:00
rcore_desktop_rgfw.c fixed an issue when using an empty window title (#5526) 2026-02-03 23:12:13 +01:00
rcore_desktop_sdl.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
rcore_desktop_win32.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
rcore_drm.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
rcore_memory.c REVIEWED: Some comments (Code Gardening) 2026-01-19 12:40:32 +01:00
rcore_template.c Update year to 2026 2026-01-02 13:40:15 +01:00
rcore_web.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00
rcore_web_emscripten.c REVIEWED: Comments to impersonal format 2026-02-12 18:55:40 +01:00