mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-27 13:55:03 +00:00
* 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