mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
remove redundent global variables
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -65,24 +65,12 @@ impl WindowHandlers {
|
||||
}
|
||||
|
||||
pub struct PrivacyModeImpl {
|
||||
impl_key: String,
|
||||
conn_id: i32,
|
||||
handlers: WindowHandlers,
|
||||
hwnd: u64,
|
||||
}
|
||||
|
||||
impl Default for PrivacyModeImpl {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
conn_id: INVALID_PRIVACY_MODE_CONN_ID,
|
||||
handlers: WindowHandlers {
|
||||
hthread: 0,
|
||||
hprocess: 0,
|
||||
},
|
||||
hwnd: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl PrivacyMode for PrivacyModeImpl {
|
||||
fn init(&self) -> ResultType<()> {
|
||||
Ok(())
|
||||
@@ -163,9 +151,26 @@ impl PrivacyMode for PrivacyModeImpl {
|
||||
fn pre_conn_id(&self) -> i32 {
|
||||
self.conn_id
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_impl_key(&self) -> &str {
|
||||
&self.impl_key
|
||||
}
|
||||
}
|
||||
|
||||
impl PrivacyModeImpl {
|
||||
pub fn new(impl_key: &str) -> Self {
|
||||
Self {
|
||||
impl_key: impl_key.to_owned(),
|
||||
conn_id: INVALID_PRIVACY_MODE_CONN_ID,
|
||||
handlers: WindowHandlers {
|
||||
hthread: 0,
|
||||
hprocess: 0,
|
||||
},
|
||||
hwnd: 0,
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn get_hwnd(&self) -> u64 {
|
||||
self.hwnd
|
||||
@@ -372,4 +377,3 @@ pub(super) fn wait_find_privacy_hwnd(msecs: u128) -> ResultType<HWND> {
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,23 +35,13 @@ struct Display {
|
||||
}
|
||||
|
||||
pub struct PrivacyModeImpl {
|
||||
impl_key: String,
|
||||
conn_id: i32,
|
||||
displays: Vec<Display>,
|
||||
virtual_displays: Vec<Display>,
|
||||
virtual_displays_added: Vec<u32>,
|
||||
}
|
||||
|
||||
impl Default for PrivacyModeImpl {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
conn_id: INVALID_PRIVACY_MODE_CONN_ID,
|
||||
displays: Vec::new(),
|
||||
virtual_displays: Vec::new(),
|
||||
virtual_displays_added: Vec::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct TurnOnGuard<'a> {
|
||||
privacy_mode: &'a mut PrivacyModeImpl,
|
||||
succeeded: bool,
|
||||
@@ -82,6 +72,16 @@ impl<'a> Drop for TurnOnGuard<'a> {
|
||||
}
|
||||
|
||||
impl PrivacyModeImpl {
|
||||
pub fn new(impl_key: &str) -> Self {
|
||||
Self {
|
||||
impl_key: impl_key.to_owned(),
|
||||
conn_id: INVALID_PRIVACY_MODE_CONN_ID,
|
||||
displays: Vec::new(),
|
||||
virtual_displays: Vec::new(),
|
||||
virtual_displays_added: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
// mainly from https://github.com/fufesou/rustdesk/blob/44c3a52ca8502cf53b58b59db130611778d34dbe/libs/scrap/src/dxgi/mod.rs#L365
|
||||
fn set_displays(&mut self) {
|
||||
self.displays.clear();
|
||||
@@ -431,6 +431,11 @@ impl PrivacyMode for PrivacyModeImpl {
|
||||
fn pre_conn_id(&self) -> i32 {
|
||||
self.conn_id
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn get_impl_key(&self) -> &str {
|
||||
&self.impl_key
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for PrivacyModeImpl {
|
||||
|
||||
Reference in New Issue
Block a user