From 3f3bca753cc4a32706d052ca67d6fe531acf4989 Mon Sep 17 00:00:00 2001 From: fufesou Date: Sat, 18 Nov 2023 12:14:21 +0800 Subject: [PATCH] feat, install indirect display driver when installing the app Signed-off-by: fufesou --- src/core_main.rs | 2 ++ src/virtual_display_manager.rs | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/core_main.rs b/src/core_main.rs index ba49ff1c2..dc439f344 100644 --- a/src/core_main.rs +++ b/src/core_main.rs @@ -203,6 +203,8 @@ pub fn core_main() -> Option> { } else if args[0] == "--install-cert" { #[cfg(windows)] hbb_common::allow_err!(crate::platform::windows::install_cert(&args[1])); + #[cfg(all(windows, feature = "virtual_display_driver"))] + hbb_common::allow_err!(crate::virtual_display_manager::install_update_driver()); return None; } else if args[0] == "--uninstall-cert" { #[cfg(windows)] diff --git a/src/virtual_display_manager.rs b/src/virtual_display_manager.rs index b08c7dab9..c51b74baf 100644 --- a/src/virtual_display_manager.rs +++ b/src/virtual_display_manager.rs @@ -53,6 +53,13 @@ impl VirtualDisplayManager { } } +pub fn install_update_driver() -> ResultType<()> { + VIRTUAL_DISPLAY_MANAGER + .lock() + .unwrap() + .install_update_driver() +} + pub fn plug_in_headless() -> ResultType<()> { let mut manager = VIRTUAL_DISPLAY_MANAGER.lock().unwrap(); manager.prepare_driver()?;