Don't use headless winit event loop on macOS.

This commit is contained in:
Josh Matthews 2021-03-14 17:24:30 -04:00
parent 490c215798
commit 21e31547ea

View file

@ -29,11 +29,11 @@ pub struct EventsLoop(EventLoop);
impl EventsLoop { impl EventsLoop {
// Ideally, we could use the winit event loop in both modes, // Ideally, we could use the winit event loop in both modes,
// but on Linux, the event loop requires a X11 server. // but on Linux, the event loop requires a X11 server.
#[cfg(not(target_os = "linux"))] #[cfg(not(any(target_os = "linux", target_os = "macos")))]
pub fn new(_headless: bool) -> EventsLoop { pub fn new(_headless: bool) -> EventsLoop {
EventsLoop(EventLoop::Winit(Some(winit::event_loop::EventLoop::with_user_event()))) EventsLoop(EventLoop::Winit(Some(winit::event_loop::EventLoop::with_user_event())))
} }
#[cfg(target_os = "linux")] #[cfg(any(target_os = "linux", target_os = "macos"))]
pub fn new(headless: bool) -> EventsLoop { pub fn new(headless: bool) -> EventsLoop {
EventsLoop(if headless { EventsLoop(if headless {
EventLoop::Headless(Arc::new((Mutex::new(false), Condvar::new()))) EventLoop::Headless(Arc::new((Mutex::new(false), Condvar::new())))