Merge pull request #4557 from 21pages/wakelock2

keep server device awake if have connection
This commit is contained in:
RustDesk
2023-06-05 23:27:55 +08:00
committed by GitHub
6 changed files with 344 additions and 11 deletions

View File

@@ -506,6 +506,8 @@ fn check_get_displays_changed_msg() -> Option<Message> {
}
fn run(sp: GenericService) -> ResultType<()> {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
let _wake_lock = get_wake_lock();
#[cfg(all(windows, feature = "virtual_display_driver"))]
ensure_close_virtual_device()?;
@@ -1060,3 +1062,16 @@ fn start_uac_elevation_check() {
}
});
}
#[cfg(not(any(target_os = "android", target_os = "ios")))]
fn get_wake_lock() -> crate::platform::WakeLock {
let (display, idle, sleep) = if cfg!(windows) {
(true, false, false)
} else if cfg!(linux) {
(false, false, true)
} else {
//macos
(true, false, false)
};
crate::platform::WakeLock::new(display, idle, sleep)
}