diff --git a/Cargo.lock b/Cargo.lock index b4bf7452e..974c02228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5163,7 +5163,6 @@ dependencies = [ "libloading 0.6.7", "line_drawing", "log", - "memmap", "metrics", "mio", "objc", diff --git a/wezterm-gui/Cargo.toml b/wezterm-gui/Cargo.toml index f9b49bc0e..2ba32ba89 100644 --- a/wezterm-gui/Cargo.toml +++ b/wezterm-gui/Cargo.toml @@ -69,7 +69,7 @@ wezterm-mux-server-impl = { path = "../wezterm-mux-server-impl" } wezterm-ssh = { path = "../wezterm-ssh" } wezterm-term = { path = "../term", features=["use_serde"] } wezterm-toast-notification = { path = "../wezterm-toast-notification" } -window = { path = "../window", features=["wayland"]} +window = { path = "../window" } [target."cfg(windows)".dependencies] shared_library = "0.1" diff --git a/window/Cargo.toml b/window/Cargo.toml index 2d9917f90..c05ac0056 100644 --- a/window/Cargo.toml +++ b/window/Cargo.toml @@ -37,9 +37,6 @@ serde = {version="1.0", features = ["rc", "derive"]} glium = { version = "0.28", default-features = false} wezterm-input-types = { path = "../wezterm-input-types" } -[features] -wayland = ["smithay-client-toolkit", "memmap", "wayland-client", "wayland-egl"] - [target."cfg(windows)".dependencies] winapi = { version = "0.3", features = [ "dwmapi", @@ -64,10 +61,9 @@ xkbcommon = { version = "0.5", features = ["x11", "wayland"], git="https://githu mio = "0.6" libc = "0.2" #smithay-client-toolkit = {version = "0.9", optional = true, features=["calloop"], git="https://github.com/wez/client-toolkit.git", branch="title_trunc"} -smithay-client-toolkit = {version = "0.12", optional = true, features=["calloop"]} -memmap = {version="0.7", optional=true} -wayland-client = {version="0.28", optional=true} -wayland-egl = {version="0.28", optional=true} +smithay-client-toolkit = {version = "0.12", features=["calloop"]} +wayland-client = "0.28" +wayland-egl = "0.28" [target.'cfg(target_os="macos")'.dependencies] cocoa = "0.20" diff --git a/window/src/egl.rs b/window/src/egl.rs index f55db310e..997b17ce7 100644 --- a/window/src/egl.rs +++ b/window/src/egl.rs @@ -461,7 +461,7 @@ impl GlState { bail!("with_egl_lib failed: {}", errors.join(", ")) } - #[cfg(all(unix, feature = "wayland", not(target_os = "macos")))] + #[cfg(all(unix, not(target_os = "macos")))] pub fn create_wayland( display: Option, wegl_surface: &wayland_egl::WlEglSurface, @@ -488,7 +488,7 @@ impl GlState { }) } - #[cfg(all(unix, feature = "wayland", not(target_os = "macos")))] + #[cfg(all(unix, not(target_os = "macos")))] pub fn create_wayland_with_existing_connection( connection: &Rc, wegl_surface: &wayland_egl::WlEglSurface, diff --git a/window/src/os/wayland/mod.rs b/window/src/os/wayland/mod.rs index 2603bb988..e7aaea000 100644 --- a/window/src/os/wayland/mod.rs +++ b/window/src/os/wayland/mod.rs @@ -1,4 +1,4 @@ -#![cfg(all(unix, feature = "wayland", not(target_os = "macos")))] +#![cfg(all(unix, not(target_os = "macos")))] pub mod connection; pub mod window; diff --git a/window/src/os/x_and_wayland.rs b/window/src/os/x_and_wayland.rs index d6ae157d5..c42099c6e 100644 --- a/window/src/os/x_and_wayland.rs +++ b/window/src/os/x_and_wayland.rs @@ -1,9 +1,7 @@ #![cfg(all(unix, not(target_os = "macos")))] use crate::connection::ConnectionOps; -#[cfg(feature = "wayland")] use crate::os::wayland::connection::WaylandConnection; -#[cfg(feature = "wayland")] use crate::os::wayland::window::WaylandWindow; use crate::os::x11::connection::XConnection; use crate::os::x11::window::XWindow; @@ -17,30 +15,25 @@ use std::rc::Rc; pub enum Connection { X11(Rc), - #[cfg(feature = "wayland")] Wayland(Rc), } #[derive(Clone)] pub enum Window { X11(XWindow), - #[cfg(feature = "wayland")] Wayland(WaylandWindow), } impl Connection { pub(crate) fn create_new() -> anyhow::Result { - #[cfg(feature = "wayland")] - { - if config::configuration().enable_wayland { - match WaylandConnection::create_new() { - Ok(w) => { - log::debug!("Using wayland connection!"); - return Ok(Connection::Wayland(Rc::new(w))); - } - Err(e) => { - log::debug!("Failed to init wayland: {}", e); - } + if config::configuration().enable_wayland { + match WaylandConnection::create_new() { + Ok(w) => { + log::debug!("Using wayland connection!"); + return Ok(Connection::Wayland(Rc::new(w))); + } + Err(e) => { + log::debug!("Failed to init wayland: {}", e); } } } @@ -57,7 +50,6 @@ impl Connection { ) -> anyhow::Result<(Window, WindowEventReceiver)> { match self { Self::X11(_) => XWindow::new_window(class_name, name, width, height, config).await, - #[cfg(feature = "wayland")] Self::Wayland(_) => { WaylandWindow::new_window(class_name, name, width, height, config).await } @@ -67,12 +59,10 @@ impl Connection { pub(crate) fn x11(&self) -> Rc { match self { Self::X11(x) => Rc::clone(x), - #[cfg(feature = "wayland")] _ => panic!("attempted to get x11 reference on non-x11 connection"), } } - #[cfg(feature = "wayland")] pub(crate) fn wayland(&self) -> Rc { match self { Self::Wayland(w) => Rc::clone(w), @@ -85,7 +75,6 @@ impl ConnectionOps for Connection { fn terminate_message_loop(&self) { match self { Self::X11(x) => x.terminate_message_loop(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.terminate_message_loop(), } } @@ -93,7 +82,6 @@ impl ConnectionOps for Connection { fn run_message_loop(&self) -> anyhow::Result<()> { match self { Self::X11(x) => x.run_message_loop(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.run_message_loop(), } } @@ -118,7 +106,6 @@ unsafe impl HasRawWindowHandle for Window { fn raw_window_handle(&self) -> RawWindowHandle { match self { Self::X11(x) => x.raw_window_handle(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.raw_window_handle(), } } @@ -129,7 +116,6 @@ impl WindowOps for Window { async fn enable_opengl(&self) -> anyhow::Result> { match self { Self::X11(x) => x.enable_opengl().await, - #[cfg(feature = "wayland")] Self::Wayland(w) => w.enable_opengl().await, } } @@ -137,7 +123,6 @@ impl WindowOps for Window { fn finish_frame(&self, frame: glium::Frame) -> anyhow::Result<()> { match self { Self::X11(x) => x.finish_frame(frame), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.finish_frame(frame), } } @@ -145,7 +130,6 @@ impl WindowOps for Window { fn close(&self) -> Future<()> { match self { Self::X11(x) => x.close(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.close(), } } @@ -155,7 +139,6 @@ impl WindowOps for Window { { match self { Self::X11(x) => x.notify(t), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.notify(t), } } @@ -163,7 +146,6 @@ impl WindowOps for Window { fn hide(&self) -> Future<()> { match self { Self::X11(x) => x.hide(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.hide(), } } @@ -171,7 +153,6 @@ impl WindowOps for Window { fn toggle_fullscreen(&self) -> Future<()> { match self { Self::X11(x) => x.toggle_fullscreen(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.toggle_fullscreen(), } } @@ -179,7 +160,6 @@ impl WindowOps for Window { fn config_did_change(&self, config: &ConfigHandle) -> Future<()> { match self { Self::X11(x) => x.config_did_change(config), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.config_did_change(config), } } @@ -187,7 +167,6 @@ impl WindowOps for Window { fn show(&self) -> Future<()> { match self { Self::X11(x) => x.show(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.show(), } } @@ -195,7 +174,6 @@ impl WindowOps for Window { fn set_cursor(&self, cursor: Option) -> Future<()> { match self { Self::X11(x) => x.set_cursor(cursor), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.set_cursor(cursor), } } @@ -203,7 +181,6 @@ impl WindowOps for Window { fn invalidate(&self) -> Future<()> { match self { Self::X11(x) => x.invalidate(), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.invalidate(), } } @@ -211,7 +188,6 @@ impl WindowOps for Window { fn set_title(&self, title: &str) -> Future<()> { match self { Self::X11(x) => x.set_title(title), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.set_title(title), } } @@ -219,7 +195,6 @@ impl WindowOps for Window { fn set_icon(&self, image: crate::bitmaps::Image) -> Future<()> { match self { Self::X11(x) => x.set_icon(image), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.set_icon(image), } } @@ -227,7 +202,6 @@ impl WindowOps for Window { fn set_inner_size(&self, width: usize, height: usize) -> Future { match self { Self::X11(x) => x.set_inner_size(width, height), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.set_inner_size(width, height), } } @@ -235,7 +209,6 @@ impl WindowOps for Window { fn set_window_position(&self, coords: ScreenPoint) -> Future<()> { match self { Self::X11(x) => x.set_window_position(coords), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.set_window_position(coords), } } @@ -243,14 +216,12 @@ impl WindowOps for Window { fn get_clipboard(&self, clipboard: Clipboard) -> Future { match self { Self::X11(x) => x.get_clipboard(clipboard), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.get_clipboard(clipboard), } } fn set_clipboard(&self, clipboard: Clipboard, text: String) -> Future<()> { match self { Self::X11(x) => x.set_clipboard(clipboard, text), - #[cfg(feature = "wayland")] Self::Wayland(w) => w.set_clipboard(clipboard, text), } }