mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +08:00
privacy_mode_win_magnifier: fix crash when resolution changed
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
5182b96bda
commit
18ba55056f
@ -364,6 +364,17 @@ impl CapturerMag {
|
||||
));
|
||||
}
|
||||
|
||||
let x = GetSystemMetrics(SM_XVIRTUALSCREEN);
|
||||
let y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
let w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||
let h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
s.rect = RECT {
|
||||
left: x as _,
|
||||
top: y as _,
|
||||
right: (x + w) as _,
|
||||
bottom: (y + h) as _,
|
||||
};
|
||||
|
||||
// Create the magnifier control.
|
||||
s.magnifier_window = CreateWindowExA(
|
||||
0,
|
||||
@ -487,13 +498,26 @@ impl CapturerMag {
|
||||
let y = GetSystemMetrics(SM_YVIRTUALSCREEN);
|
||||
let w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
|
||||
let h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
|
||||
|
||||
self.rect = RECT {
|
||||
left: x as _,
|
||||
top: y as _,
|
||||
right: (x + w) as _,
|
||||
bottom: (y + h) as _,
|
||||
};
|
||||
if !(self.rect.left == x as _
|
||||
&& self.rect.top == y as _
|
||||
&& self.rect.right == (x + w) as _
|
||||
&& self.rect.bottom == (y + h) as _)
|
||||
{
|
||||
return Err(Error::new(
|
||||
ErrorKind::Other,
|
||||
format!(
|
||||
"Failed Check screen rect ({}, {}, {} , {}) to ({}, {}, {}, {})",
|
||||
self.rect.left,
|
||||
self.rect.top,
|
||||
self.rect.right,
|
||||
self.rect.bottom,
|
||||
x,
|
||||
y,
|
||||
x + w,
|
||||
y + h
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
if FALSE
|
||||
== SetWindowPos(
|
||||
@ -623,4 +647,4 @@ mod tests {
|
||||
capture_mag.frame(&mut data).unwrap();
|
||||
println!("capture data len: {}", data.len());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Specify the Windows subsystem to eliminate console window.
|
||||
// Requires Rust 1.18.
|
||||
#![windows_subsystem = "windows"]
|
||||
//#![windows_subsystem = "windows"]
|
||||
|
||||
use hbb_common::log;
|
||||
use librustdesk::*;
|
||||
|
@ -269,6 +269,7 @@ fn create_capturer(privacy_mode_id: i32, display: Display) -> ResultType<Box<dyn
|
||||
PRIVACY_WINDOW_NAME
|
||||
);
|
||||
}
|
||||
log::info!("Create maginifier capture for {}", privacy_mode_id);
|
||||
c = Some(Box::new(c1));
|
||||
}
|
||||
Err(e) => {
|
||||
|
Loading…
Reference in New Issue
Block a user