Skip to content

Commit

Permalink
On X11, fix error propagation in EventLoop::new
Browse files Browse the repository at this point in the history
Fixes #3350.
  • Loading branch information
kchibisov committed Jan 5, 2024
1 parent cf0a533 commit fdedda3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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`.

Expand Down
6 changes: 3 additions & 3 deletions src/platform_impl/linux/mod.rs
Expand Up @@ -784,7 +784,7 @@ impl<T: 'static> EventLoop<T> {
#[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),
}
}

Expand All @@ -794,10 +794,10 @@ impl<T: 'static> EventLoop<T> {
}

#[cfg(x11_platform)]
fn new_x11_any_thread() -> Result<EventLoop<T>, XNotSupported> {
fn new_x11_any_thread() -> Result<EventLoop<T>, 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)))
Expand Down

0 comments on commit fdedda3

Please sign in to comment.