mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
@@ -32,6 +32,7 @@ use std::{
|
||||
io::ErrorKind::WouldBlock,
|
||||
time::{self, Duration, Instant},
|
||||
};
|
||||
use virtual_display;
|
||||
|
||||
const WAIT_BASE: i32 = 17;
|
||||
pub const NAME: &'static str = "video";
|
||||
@@ -446,6 +447,12 @@ fn get_current_display() -> ResultType<(usize, usize, Display)> {
|
||||
let mut current = *CURRENT_DISPLAY.lock().unwrap() as usize;
|
||||
let mut displays = Display::all()?;
|
||||
if displays.len() == 0 {
|
||||
// try plugin monitor
|
||||
if virtual_display::is_device_created() {
|
||||
if let Err(e) = virtual_display::plug_in_monitor() {
|
||||
log::error!("plug in monitor failed {}", e)
|
||||
}
|
||||
}
|
||||
bail!("No displays");
|
||||
}
|
||||
let n = displays.len();
|
||||
|
||||
14
src/ui.rs
14
src/ui.rs
@@ -19,6 +19,7 @@ use std::{
|
||||
process::Child,
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
use virtual_display;
|
||||
|
||||
pub type Childs = Arc<Mutex<(bool, HashMap<(String, String), Child>)>>;
|
||||
|
||||
@@ -364,6 +365,18 @@ impl UI {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: ui prompt
|
||||
fn install_virtual_display(&self) {
|
||||
match virtual_display::install_update_driver() {
|
||||
Ok(_) => {
|
||||
log::info!("Virtual Display: install virtual display done");
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Virtual Display: install virtual display failed {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn install_path(&mut self) -> String {
|
||||
#[cfg(windows)]
|
||||
return crate::platform::windows::get_install_info().1;
|
||||
@@ -690,6 +703,7 @@ impl sciter::EventHandler for UI {
|
||||
fn get_sound_inputs();
|
||||
fn set_options(Value);
|
||||
fn set_option(String, String);
|
||||
fn install_virtual_display();
|
||||
fn get_software_update_url();
|
||||
fn get_new_version();
|
||||
fn get_version();
|
||||
|
||||
@@ -168,6 +168,7 @@ class MyIdMenu: Reactor.Component {
|
||||
<li #custom-server>{translate('ID/Relay Server')}</li>
|
||||
<li #whitelist title={translate('whitelist_tip')}>{translate('IP Whitelisting')}</li>
|
||||
<li #socks5-server>{translate('Socks5 Proxy')}</li>
|
||||
{is_win ? <li #install-virtual-display>Install virtual display</li> : ""}
|
||||
<div .separator />
|
||||
<li #stop-service class={service_stopped ? "line-through" : "selected"}><span>{svg_checkmark}</span>{translate("Enable Service")}</li>
|
||||
<DirectServer />
|
||||
@@ -268,6 +269,8 @@ class MyIdMenu: Reactor.Component {
|
||||
}
|
||||
handler.set_socks(proxy, username, password);
|
||||
}, 240);
|
||||
} else if (me.id == "install-virtual-display") {
|
||||
handler.install_virtual_display();
|
||||
} else if (me.id == "stop-service") {
|
||||
handler.set_option("stop-service", service_stopped ? "" : "Y");
|
||||
} else if (me.id == "about") {
|
||||
|
||||
Reference in New Issue
Block a user