From 021fd23c34e3f89d806e268b293826d66e7d552a Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Fri, 5 Jan 2024 08:33:23 +0400 Subject: [PATCH] On X11, fix error propagation in EventLoop::new Fixes #3350. --- CHANGELOG.md | 1 + src/platform_impl/linux/mod.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eab253a6d2..df9fe00acd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Unreleased` header. # Unreleased +- On X11, fix `NotSupported` error not propagated when creating event loop. - On Wayland, fix resize not issued when scale changes - On X11 and Wayland, fix arrow up on keypad reported as `ArrowLeft`. - On Windows, macOS, X11, Wayland and Web, implement setting images as cursors. See the `custom_cursors.rs` example. diff --git a/src/platform_impl/linux/mod.rs b/src/platform_impl/linux/mod.rs index 7f310fb4bd..4555751acb 100644 --- a/src/platform_impl/linux/mod.rs +++ b/src/platform_impl/linux/mod.rs @@ -756,7 +756,7 @@ impl EventLoop { #[cfg(wayland_platform)] Backend::Wayland => EventLoop::new_wayland_any_thread().map_err(Into::into), #[cfg(x11_platform)] - Backend::X => Ok(EventLoop::new_x11_any_thread().unwrap()), + Backend::X => EventLoop::new_x11_any_thread().map_err(Into::into), } } @@ -766,10 +766,10 @@ impl EventLoop { } #[cfg(x11_platform)] - fn new_x11_any_thread() -> Result, XNotSupported> { + fn new_x11_any_thread() -> Result, EventLoopError> { let xconn = match X11_BACKEND.lock().unwrap().as_ref() { Ok(xconn) => xconn.clone(), - Err(err) => return Err(err.clone()), + Err(_) => return Err(EventLoopError::NotSupported(NotSupportedError::new())), }; Ok(EventLoop::X(x11::EventLoop::new(xconn)))