From f721370dd2272c9b154ac2c2a9fb30a7a1b25a7e Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 12:23:38 +0000 Subject: [PATCH] Refactor WaylandBackend and WmCtx to remove unsafe NonNull pointers This commit significantly restructures the Wayland backend initialization and context sharing to completely eliminate the usage of unsafe `NonNull` pointers (`NonNull`, `NonNull`, `NonNull`) that previously formed a circular dependency between `Wm` and `WaylandState`. Key changes: - `WaylandState` now natively owns the core `Wm` instance, effectively serving as the root event-loop object. - Removed the `WaylandBackend` wrapper struct entirely. `BackendRef` now just flags that Wayland is active. - `BackendOps` implementations for `WaylandBackend` have been replaced by an event queue: `WmCtx` functions (like `resize_client`, `raise`, etc.) now push a `BackendEvent` to `Globals.backend_events` when on Wayland. - Added `process_backend_events` to `WaylandState` which is invoked at the end of each frame tick in the `calloop` event loop to enact these ops. - Wrapped `GlesRenderer` in `Rc` and removed the unsafe `renderer: Option>` field, keeping the EGL and DMABUF import handlers safe. - Adjusted inputs, context wiring, and `focus_wayland` handlers to fetch state natively from `Wm` via the `BackendEvent` architecture. Co-authored-by: paperbenni <15818888+paperbenni@users.noreply.github.com>