prompt foreground window elevation

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-09-28 20:48:14 +08:00
parent ae8d97eb72
commit 02aedd234c
30 changed files with 131 additions and 30 deletions

View File

@@ -230,7 +230,8 @@ impl Connection {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
std::thread::spawn(move || Self::handle_input(rx_input, tx_cloned));
let mut second_timer = time::interval(Duration::from_secs(1));
let mut uac = false;
let mut last_uac = false;
let mut last_foreground_window_elevated = false;
loop {
tokio::select! {
@@ -403,16 +404,23 @@ impl Connection {
}
},
_ = second_timer.tick() => {
let is_uac = crate::video_service::IS_UAC_RUNNING.lock().unwrap().clone();
if uac != is_uac {
if !crate::platform::is_installed() && !crate::platform::is_root() {
uac = is_uac;
let mut misc = Misc::new();
misc.set_uac(uac);
let mut msg = Message::new();
msg.set_misc(misc);
conn.inner.send(msg.into());
}
let uac = crate::video_service::IS_UAC_RUNNING.lock().unwrap().clone();
if last_uac != uac {
last_uac = uac;
let mut misc = Misc::new();
misc.set_uac(uac);
let mut msg = Message::new();
msg.set_misc(misc);
conn.inner.send(msg.into());
}
let foreground_window_elevated = crate::video_service::IS_FOREGROUND_WINDOW_ELEVATED.lock().unwrap().clone();
if last_foreground_window_elevated != foreground_window_elevated {
last_foreground_window_elevated = foreground_window_elevated;
let mut misc = Misc::new();
misc.set_foreground_window_elevated(foreground_window_elevated);
let mut msg = Message::new();
msg.set_misc(misc);
conn.inner.send(msg.into());
}
}
_ = test_delay_timer.tick() => {