From 557e99d09ee30fa751f7bcacd7b4c5e461856787 Mon Sep 17 00:00:00 2001 From: fufesou Date: Tue, 29 Nov 2022 22:08:09 +0800 Subject: [PATCH] wayalnd, do not share screen when no connections Signed-off-by: fufesou --- src/server.rs | 1 - src/server/video_service.rs | 15 +++++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/server.rs b/src/server.rs index a12a31dbd..91a0da071 100644 --- a/src/server.rs +++ b/src/server.rs @@ -379,7 +379,6 @@ pub async fn start_server(is_server: bool) { #[cfg(windows)] crate::platform::windows::bootstrap(); input_service::fix_key_down_timeout_loop(); - allow_err!(video_service::check_init().await); #[cfg(target_os = "macos")] tokio::spawn(async { sync_and_watch_config_dir().await }); crate::RendezvousMediator::start_all().await; diff --git a/src/server/video_service.rs b/src/server/video_service.rs index a169b3835..173373dbc 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -660,6 +660,11 @@ fn run(sp: GenericService) -> ResultType<()> { std::thread::sleep(spf - elapsed); } } + + if !scrap::is_x11() { + super::wayland::release_resouce(); + } + Ok(()) } @@ -764,16 +769,6 @@ fn get_display_num() -> usize { } } -pub async fn check_init() -> ResultType<()> { - #[cfg(target_os = "linux")] - { - if !scrap::is_x11() { - return super::wayland::check_init().await; - } - } - Ok(()) -} - pub(super) fn get_displays_2(all: &Vec) -> (usize, Vec) { let mut displays = Vec::new(); let mut primary = 0;