Merge pull request #3490 from fufesou/fix/some_incorrect_logic

fix some incorrect capture magnifier logic
This commit is contained in:
RustDesk 2023-03-03 21:18:02 +08:00 committed by GitHub
commit 36611a1f33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -282,10 +282,10 @@ impl CapturerMag {
let y = GetSystemMetrics(SM_YVIRTUALSCREEN); let y = GetSystemMetrics(SM_YVIRTUALSCREEN);
let w = GetSystemMetrics(SM_CXVIRTUALSCREEN); let w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
let h = GetSystemMetrics(SM_CYVIRTUALSCREEN); let h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
if !(origin.0 == x as i32 if !(origin.0 >= x as i32
&& origin.1 == y as i32 && origin.1 >= y as i32
&& width == w as usize && width <= w as usize
&& height == h as usize) && height <= h as usize)
{ {
return Err(Error::new( return Err(Error::new(
ErrorKind::Other, ErrorKind::Other,
@ -518,10 +518,10 @@ impl CapturerMag {
let y = GetSystemMetrics(SM_YVIRTUALSCREEN); let y = GetSystemMetrics(SM_YVIRTUALSCREEN);
let w = GetSystemMetrics(SM_CXVIRTUALSCREEN); let w = GetSystemMetrics(SM_CXVIRTUALSCREEN);
let h = GetSystemMetrics(SM_CYVIRTUALSCREEN); let h = GetSystemMetrics(SM_CYVIRTUALSCREEN);
if !(self.rect.left == x as i32 if !(self.rect.left >= x as i32
&& self.rect.top == y as i32 && self.rect.top >= y as i32
&& self.rect.right == (x + w) as i32 && self.rect.right <= (x + w) as i32
&& self.rect.bottom == (y + h) as i32) && self.rect.bottom <= (y + h) as i32)
{ {
return Err(Error::new( return Err(Error::new(
ErrorKind::Other, ErrorKind::Other,
@ -545,8 +545,8 @@ impl CapturerMag {
HWND_TOP, HWND_TOP,
self.rect.left, self.rect.left,
self.rect.top, self.rect.top,
self.rect.right, self.rect.right - self.rect.left,
self.rect.bottom, self.rect.bottom - self.rect.top,
0, 0,
) )
{ {
@ -556,8 +556,8 @@ impl CapturerMag {
"Failed SetWindowPos (x, y, w , h) - ({}, {}, {}, {}), error {}", "Failed SetWindowPos (x, y, w , h) - ({}, {}, {}, {}), error {}",
self.rect.left, self.rect.left,
self.rect.top, self.rect.top,
self.rect.right, self.rect.right - self.rect.left,
self.rect.bottom, self.rect.bottom - self.rect.top,
GetLastError() GetLastError()
), ),
)); ));