diff --git a/src/common.rs b/src/common.rs index f83fbc69d..3aa7e3815 100644 --- a/src/common.rs +++ b/src/common.rs @@ -50,6 +50,7 @@ lazy_static::lazy_static! { } pub fn global_init() -> bool { + #[cfg(not(feature = "cli"))] #[cfg(target_os = "linux")] { if !scrap::is_x11() { diff --git a/src/server.rs b/src/server.rs index 4e57d9e46..b1b252446 100644 --- a/src/server.rs +++ b/src/server.rs @@ -31,6 +31,7 @@ pub mod audio_service; cfg_if::cfg_if! { if #[cfg(not(any(target_os = "android", target_os = "ios")))] { mod clipboard_service; +#[cfg(not(feature = "cli"))] #[cfg(target_os = "linux")] pub(crate) mod wayland; #[cfg(target_os = "linux")] @@ -318,6 +319,7 @@ impl Drop for Server { for s in self.services.values() { s.join(); } + #[cfg(not(feature = "cli"))] #[cfg(target_os = "linux")] wayland::clear(); } diff --git a/src/server/connection.rs b/src/server/connection.rs index e1a360e7a..32b1a04e0 100644 --- a/src/server/connection.rs +++ b/src/server/connection.rs @@ -500,6 +500,7 @@ impl Connection { let _ = privacy_mode::turn_off_privacy(0); } video_service::notify_video_frame_feched(id, None); + #[cfg(not(feature = "cli"))] scrap::codec::Encoder::update_video_encoder(id, scrap::codec::EncoderUpdate::Remove); video_service::VIDEO_QOS.lock().unwrap().reset(); if conn.authorized { @@ -1076,17 +1077,20 @@ impl Connection { if let Some(o) = lr.option.as_ref() { self.update_option(o).await; if let Some(q) = o.video_codec_state.clone().take() { + #[cfg(not(feature = "cli"))] scrap::codec::Encoder::update_video_encoder( self.inner.id(), scrap::codec::EncoderUpdate::State(q), ); } else { + #[cfg(not(feature = "cli"))] scrap::codec::Encoder::update_video_encoder( self.inner.id(), scrap::codec::EncoderUpdate::DisableHwIfNotExist, ); } } else { + #[cfg(not(feature = "cli"))] scrap::codec::Encoder::update_video_encoder( self.inner.id(), scrap::codec::EncoderUpdate::DisableHwIfNotExist, @@ -1645,6 +1649,7 @@ impl Connection { } } if let Some(q) = o.video_codec_state.clone().take() { + #[cfg(not(feature = "cli"))] scrap::codec::Encoder::update_video_encoder( self.inner.id(), scrap::codec::EncoderUpdate::State(q),