| ... | ... | @@ -17,7 +17,10 @@ use ui::{Flags, Spec, Ui, px}; |
| 17 | 17 | use winit::{ |
| 18 | 18 | error::EventLoopError, |
| 19 | 19 | event_loop::{EventLoop, EventLoopProxy}, |
| 20 | | platform::wayland::{EventLoopExtWayland, WindowAttributesExtWayland}, |
| 20 | platform::{ |
| 21 | wayland::{EventLoopExtWayland, WindowAttributesExtWayland}, |
| 22 | x11::EventLoopBuilderExtX11, |
| 23 | }, |
| 21 | 24 | window::{ResizeDirection, Theme, Window, WindowAttributes}, |
| 22 | 25 | }; |
| 23 | 26 | |
| ... | ... | @@ -41,7 +44,16 @@ static BREEZE_RADIUS: AtomicU32 = AtomicU32::new(0); |
| 41 | 44 | pub fn event_loop(headless: bool) -> Result<EventLoop<crate::UserEvent>, EventLoopError> { |
| 42 | 45 | // Month and day names and date orders follow the user's locale; other categories stay C. |
| 43 | 46 | unsafe { libc::setlocale(libc::LC_TIME, c"".as_ptr()) }; |
| 44 | | let event_loop = EventLoop::with_user_event().build()?; |
| 47 | let mut builder = EventLoop::with_user_event(); |
| 48 | // winit takes Wayland wherever a compositor is named, even without libwayland-client. |
| 49 | let named = |names: &[&str]| names.iter().any(|name| std::env::var_os(name).is_some()); |
| 50 | if named(&["WAYLAND_DISPLAY", "WAYLAND_SOCKET"]) |
| 51 | && named(&["DISPLAY"]) |
| 52 | && !crate::loader::loads(c"libwayland-client.so.0") |
| 53 | { |
| 54 | builder.with_x11(); |
| 55 | } |
| 56 | let event_loop = builder.build()?; |
| 45 | 57 | if !headless { |
| 46 | 58 | crate::desktop::prepare(&event_loop); |
| 47 | 59 | } |