Closed spearman closed 3 weeks ago
When calling set_cursor_visible from a thread other than main, the code is blocked forever waiting on recv(): https://github.com/rust-windowing/winit/blob/v0.30.5/src/platform_impl/windows/window.rs#L472
set_cursor_visible
use std; use winit; use winit::event_loop::EventLoop; use winit::window::WindowAttributes; fn main() { let event_loop = EventLoop::new().unwrap(); #[allow(deprecated)] let window = event_loop.create_window(WindowAttributes::default()).unwrap(); window.set_cursor_visible(true); println!("set cursor visible on main"); // spawn thread let thread_handle = std::thread::spawn(move ||{ window.set_cursor_visible(true); // blocks forever println!("set cursor visible on thread"); }); thread_handle.join().unwrap(); }
Microsoft Windows [Version 10.0.19043.928]
0.30.5
Likely cause: You have to be running the event loop. I at least know that this would also block on macOS if you don't do that.
That seems to be it, I'll close this
Description
When calling
set_cursor_visible
from a thread other than main, the code is blocked forever waiting on recv(): https://github.com/rust-windowing/winit/blob/v0.30.5/src/platform_impl/windows/window.rs#L472Windows version
Winit version
0.30.5