From 82c97858dff3865209fdf72131af48e9cf47f62d Mon Sep 17 00:00:00 2001 From: bmh129 Date: Wed, 18 Nov 2026 03:26:39 -0600 Subject: [PATCH] Linux: run on native Wayland again by default (revert #165) (#2789) * Linux: run on native Wayland again by default (revert #165) winit 0.30.13 reported dropped files only on X11. The egui 0.37 migration (#2543) pins storytold/winit, whose patch W15 reports file drops through a per-seat Wayland data device (rust-windowing/winit#4729), so files dragged from the file manager open on native Wayland too. The XWayland default is no longer needed. It also costs a startup crash: winit's X11 backend loads libxkbcommon-x11, which the Linux packages don't depend on. Where it's missing (a Fedora toolbox, minimal installs), GridCraft panics before the window opens: "Library libxkbcommon-x11.so could not be loaded." Checked on GNOME (Wayland, Fedora 44) with a build of main plus other proposed changes, run with GRIDCRAFT_WAYLAND=1 (the path this revert makes the default): an .xlsx and a .csv dragged from Files each open as a workbook, and the app starts without libxkbcommon-x11 installed. This reverts commit 6f0e43c21c5fd71b8ac6c30ac86d447f7671240f. Claude-Session: https://claude.ai/code/session_01Rvu8dWh26U2fsLQMSBQfH8 --- apps/gridcraft/Cargo.toml | 3 --- apps/gridcraft/src/main.rs | 12 +----------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/apps/gridcraft/Cargo.toml b/apps/gridcraft/Cargo.toml index 72f5d0855..572e89fa0 100644 --- a/apps/gridcraft/Cargo.toml +++ b/apps/gridcraft/Cargo.toml @@ -25,9 +25,6 @@ chrono = { workspace = true } # Icon + VERSIONINFO for gridcraft.exe; build.rs only uses it when the target is Windows. winresource = "0.1" -[target.'cfg(all(unix, not(any(target_os = "macos", target_os = "linux"))))'.dependencies] -winit = { version = "0.30", default-features = false, features = ["x11"] } - [target.'cfg(target_os = "linux")'.dependencies] # Retain X11 fallback; draw Wayland client-side controls without bundled title fonts. winit = { version = "0.30", default-features = false, features = ["x11", "wayland-csd-adwaita-notitle"] } diff --git a/apps/gridcraft/src/main.rs b/apps/gridcraft/src/main.rs index f5232b17c..753c868d7 100644 --- a/apps/gridcraft/src/main.rs +++ b/apps/gridcraft/src/main.rs @@ -358,21 +358,11 @@ fn main() -> eframe::Result<()> { } let window_builder = viewport.clone(); let options = eframe::NativeOptions { viewport, ..Default::default() }; - #[cfg(unix)] + #[cfg(target_os = "macos")] let mut options = options; // Intel Macs: Metal's compiler aborts on wgpu's indirect-validation shaders (see graphics.rs). #[cfg(target_os = "macos")] graphics::configure_indirect_validation(&mut options, graphics::skips_indirect_validation(true, cfg!(target_arch = "x86_64"))); - // winit has no file drag-and-drop on Wayland (only on X11), so dropping files from the file - // manager showed a "no" cursor. Run through XWayland when it's there; GRIDCRAFT_WAYLAND=1 - // keeps the native Wayland backend. - #[cfg(all(unix, not(target_os = "macos")))] - if std::env::var_os("DISPLAY").is_some_and(|d| !d.is_empty()) && std::env::var_os("GRIDCRAFT_WAYLAND").is_none() { - options.event_loop_builder = Some(Box::new(|b| { - use winit::platform::x11::EventLoopBuilderExtX11; - b.with_x11(); - })); - } // Before eframe creates the wgpu instance: Windows starts on DirectX 12, or OpenGL when // DirectX 12 has no GPU driver, and never touches Vulkan unless asked (see graphics.rs). #[cfg(target_os = "windows")]