enable retina scale factor (#7269)

* enable retina scale factor

* enabled only when there are only one video service running
* scale mouse event
* scale cursor position
* scale remote menu display button
* adjust resolution

Signed-off-by: 21pages <pages21@163.com>

* Update server.rs

---------

Signed-off-by: 21pages <pages21@163.com>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
This commit is contained in:
21pages
2024-02-27 22:28:23 +08:00
committed by GitHub
parent 96792bec78
commit 50d080d098
11 changed files with 210 additions and 26 deletions

View File

@@ -273,7 +273,18 @@ pub(super) fn check_update_displays(all: &Vec<Display>) {
.iter()
.map(|d| {
let display_name = d.name();
let original_resolution = get_original_resolution(&display_name, d.width(), d.height());
#[allow(unused_assignments)]
#[allow(unused_mut)]
let mut scale = 1.0;
#[cfg(target_os = "macos")]
{
scale = d.scale();
}
let original_resolution = get_original_resolution(
&display_name,
((d.width() as f64) / scale).round() as usize,
(d.height() as f64 / scale).round() as usize,
);
DisplayInfo {
x: d.origin().0 as _,
y: d.origin().1 as _,
@@ -283,6 +294,7 @@ pub(super) fn check_update_displays(all: &Vec<Display>) {
online: d.is_online(),
cursor_embedded: false,
original_resolution,
scale,
..Default::default()
}
})