debug virtual display with dummy one

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2023-06-05 08:36:32 -07:00
parent 42e8971793
commit 205798b611
2 changed files with 9 additions and 6 deletions

View File

@ -639,6 +639,10 @@ impl Connection {
if active_conns_lock.is_empty() { if active_conns_lock.is_empty() {
video_service::reset_resolutions(); video_service::reset_resolutions();
} }
#[cfg(all(windows, feature = "virtual_display_driver"))]
if active_conns_lock.is_empty() {
video_service::try_plug_out_virtual_display();
}
log::info!("#{} connection loop exited", id); log::info!("#{} connection loop exited", id);
} }

View File

@ -495,11 +495,14 @@ fn check_get_displays_changed_msg() -> Option<Message> {
Some(msg_out) Some(msg_out)
} }
#[cfg(all(windows, feature = "virtual_display_driver"))]
pub fn try_plug_out_virtual_display() {
let _res = virtual_display_manager::plug_out_headless();
}
fn run(sp: GenericService) -> ResultType<()> { fn run(sp: GenericService) -> ResultType<()> {
#[cfg(not(any(target_os = "android", target_os = "ios")))] #[cfg(not(any(target_os = "android", target_os = "ios")))]
let _wake_lock = get_wake_lock(); let _wake_lock = get_wake_lock();
#[cfg(all(windows, feature = "virtual_display_driver"))]
let _res = virtual_display_manager::plug_out_headless();
// ensure_inited() is needed because release_resource() may be called. // ensure_inited() is needed because release_resource() may be called.
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
@ -1015,10 +1018,6 @@ fn try_get_displays() -> ResultType<Vec<Display>> {
} else { } else {
displays = Display::all()?; displays = Display::all()?;
} }
} else {
if virtual_display_manager::plug_out_headless() {
displays = Display::all()?;
}
} }
Ok(displays) Ok(displays)
} }