summaryrefslogtreecommitdiffhomepage
path: root/build.zig
AgeCommit message (Collapse)Author
2026-06-29fix: switch desktop window backend GLFW -> SDL2 (reliable drag-and-drop)Adam Malczewski
The GLFW Wayland drag-and-drop crash fix (previous commit) did NOT resolve drag-and-drop on the real target (labwc), so abandon the GLFW path entirely instead of patching it further. Why SDL: raylib ships a first-class SDL backend (PLATFORM_DESKTOP_SDL) that implements file drop via SDL_DROPFILE. GLFW 3.4 (vendored in raylib 6.0) has broken Wayland drag-and-drop (wl_data_offer NULL source_actions/action listeners -> libwayland wl_abort on drag, glfw/glfw#2835) AND its X11 backend segfaults on WSLg (Mesa GLX). SDL's window/EGL/drag-drop is mature on BOTH real Wayland (labwc) and WSLg, so one backend covers both targets with no vendor patches and no X11/Wayland special-casing. Changes (desktop only; web build stays Emscripten+GLFW, untouched): - build.zig: build raylib PLATFORM=PLATFORM_DESKTOP_SDL (SDL_INCLUDE_PATH/ LIBRARY_PATH = system SDL2); link SDL2 instead of wayland-*/xkbcommon/EGL. - Revert the GLFW patch (patches/glfw-wayland-dnd-crash.patch removed; the build.zig patch-application step removed). - Docs: environment.md / study-player.md / BUILDING.md / SCREENSHOT.md updated to reflect the SDL backend + the SDL2 system dependency. The RmlUi binding is backend-agnostic (rlgl render + raylib IsKeyDown input, zero glfw* calls), so the swap is transparent to it. Prerequisite on the cyberdeck: install SDL2 dev (sudo pacman -S sdl2 or sdl2-compat) before building. Verified on the laptop (WSLg): build green; binary runs under SDL (Platform backend: DESKTOP (SDL)), window opens, no GLX segfault, RmlUi fonts load, mp3 loads from argv (132300 frames), no crash. Interactive drag-drop itself still needs user testing on the cyberdeck (SDL_DROPFILE path).
2026-06-29fix: reliable Wayland drag-and-drop (root cause: GLFW 3.4 wl_data_offer NULL ↵Adam Malczewski
listener) The rewrite builds raylib Wayland-only (X11/GLX segfaults on WSLg), but raylib 6.0 vendors GLFW 3.4 (release) which crashes the moment a file is dragged over the window on Wayland (glfw/glfw#2835, #2562): struct wl_data_offer_listener dataOfferListener = { dataOfferHandleOffer }; // source_actions (opcode 1) + action (opcode 2) handlers are NULL wl_data_offer is v3; modern compositors (labwc/GNOME/KDE) emit source_actions/action during a drag -> libwayland-client wl_abort()s on the NULL listener -> app dies on drag-enter, before any drop registers. This is why drag-and-drop is 'unreliable' in the rewrite but reliable in the original 'dev' app, which uses the X11/Xdnd backend (-D_GLFW_X11) — a separate code path with none of these bugs. Fix: backport the upstream GLFW-master fix as a committed patch applied idempotently in build.zig before (marker = dataOfferHandleAction; forces a lib rebuild when newly applied). Adds no-op source_actions/action handlers so the events are safely consumed (GLFW only needs the mime-types to accept a drop), plus guards two NULL derefs in the same data-device path (dataDeviceHandleEnter / dataDeviceHandleDrop). This keeps the Wayland-only build (no WSLg GLX regression) and fixes the crash on both WSLg and a real Wayland desktop (cyberdeck/labwc). Drop the patch once raylib vendors a GLFW release containing the upstream fix. Verified: build green; desktop binary launches, loads an mp3 from argv (132300 frames), enters the loop with no segfault. Interactive drag-drop itself still needs user testing (it's a user action; the WSLg non-interactive shell stalls the Wayland window before render).
2026-06-28import template from raylib-jamstackAdam Malczewski