authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-01 14:09:27-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-01 16:23:40-07:00
logcd1f5d42a7bb47e3adc3b9f15bdb47d635ccdb68
tree2407b824b6be4acb22d28847e317caac1d7f5e15
parent89fbf04ec821433bd822bfd0e374ead7b88b611f
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

fix: without libwayland-client, Snowbound opens through X11

winit takes Wayland whenever WAYLAND_DISPLAY is set and fails outright when libwayland-client is missing; where an X server is also named, Snowbound now asks for X11 instead. Assisted-by: claude-opus-5.5

1 files changed, 14 insertions(+), 2 deletions(-)

crates/snowbound/src/linux.rs+14-2
...@@ -17,7 +17,10 @@ use ui::{Flags, Spec, Ui, px};...@@ -17,7 +17,10 @@ use ui::{Flags, Spec, Ui, px};
17use winit::{17use winit::{
18 error::EventLoopError,18 error::EventLoopError,
19 event_loop::{EventLoop, EventLoopProxy},19 event_loop::{EventLoop, EventLoopProxy},
20 platform::wayland::{EventLoopExtWayland, WindowAttributesExtWayland},20 platform::{
21 wayland::{EventLoopExtWayland, WindowAttributesExtWayland},
22 x11::EventLoopBuilderExtX11,
23 },
21 window::{ResizeDirection, Theme, Window, WindowAttributes},24 window::{ResizeDirection, Theme, Window, WindowAttributes},
22};25};
2326
...@@ -41,7 +44,16 @@ static BREEZE_RADIUS: AtomicU32 = AtomicU32::new(0);...@@ -41,7 +44,16 @@ static BREEZE_RADIUS: AtomicU32 = AtomicU32::new(0);
41pub fn event_loop(headless: bool) -> Result<EventLoop<crate::UserEvent>, EventLoopError> {44pub fn event_loop(headless: bool) -> Result<EventLoop<crate::UserEvent>, EventLoopError> {
42 // Month and day names and date orders follow the user's locale; other categories stay C.45 // Month and day names and date orders follow the user's locale; other categories stay C.
43 unsafe { libc::setlocale(libc::LC_TIME, c"".as_ptr()) };46 unsafe { libc::setlocale(libc::LC_TIME, c"".as_ptr()) };
44 let event_loop = EventLoop::with_user_event().build()?;47 let mut builder = EventLoop::with_user_event();
48 // winit takes Wayland wherever a compositor is named, even without libwayland-client.
49 let named = |names: &[&str]| names.iter().any(|name| std::env::var_os(name).is_some());
50 if named(&["WAYLAND_DISPLAY", "WAYLAND_SOCKET"])
51 && named(&["DISPLAY"])
52 && !crate::loader::loads(c"libwayland-client.so.0")
53 {
54 builder.with_x11();
55 }
56 let event_loop = builder.build()?;
45 if !headless {57 if !headless {
46 crate::desktop::prepare(&event_loop);58 crate::desktop::prepare(&event_loop);
47 }59 }