From 7b9613038c964072adb80d3f6eef538dfc374c37 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Fri, 28 Mar 2025 19:58:33 +0100 Subject: [PATCH] Simplify API of `Viewer` --- crates/fj-viewer/src/viewer.rs | 12 ++++++------ crates/fj/src/instance.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/fj-viewer/src/viewer.rs b/crates/fj-viewer/src/viewer.rs index 12a2c2cca..f0b00f0ab 100644 --- a/crates/fj-viewer/src/viewer.rs +++ b/crates/fj-viewer/src/viewer.rs @@ -9,7 +9,7 @@ use winit::{ event::{ ElementState, KeyEvent, MouseButton, MouseScrollDelta, WindowEvent, }, - event_loop::{ActiveEventLoop, EventLoop, EventLoopClosed, EventLoopProxy}, + event_loop::{ActiveEventLoop, EventLoop, EventLoopProxy}, keyboard::{Key, NamedKey}, window::WindowId, }; @@ -60,11 +60,11 @@ impl Viewer { /// /// This can fail, if the viewer thread is no longer running. Returns the /// triangle mesh, wrapped in an error, if that is the case. - pub fn display( - &self, - tri_mesh: TriMesh, - ) -> Result<(), EventLoopClosed> { - self.event_loop.send_event(tri_mesh) + pub fn display(&self, tri_mesh: TriMesh) { + // If there's an error, that means the display thread has closed down + // and we're on our way to shutting down as well. I don't think there's + // much we can do about that. + let _ = self.event_loop.send_event(tri_mesh); } } diff --git a/crates/fj/src/instance.rs b/crates/fj/src/instance.rs index 6428f9be3..edf4f890e 100644 --- a/crates/fj/src/instance.rs +++ b/crates/fj/src/instance.rs @@ -89,7 +89,7 @@ impl Instance { } make_viewer_and_spawn_thread(|viewer| { - let _ = viewer.display(tri_mesh); + viewer.display(tri_mesh); })?; Ok(())