mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-16 13:05:47 +00:00
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:
@@ -283,6 +283,8 @@ impl Server {
|
||||
s.on_subscribe(conn.clone());
|
||||
}
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
self.update_enable_retina();
|
||||
self.connections.insert(conn.id(), conn);
|
||||
*CONN_COUNT.lock().unwrap() = self.connections.len();
|
||||
}
|
||||
@@ -293,6 +295,8 @@ impl Server {
|
||||
}
|
||||
self.connections.remove(&conn.id());
|
||||
*CONN_COUNT.lock().unwrap() = self.connections.len();
|
||||
#[cfg(target_os = "macos")]
|
||||
self.update_enable_retina();
|
||||
}
|
||||
|
||||
pub fn close_connections(&mut self) {
|
||||
@@ -325,6 +329,8 @@ impl Server {
|
||||
} else {
|
||||
s.on_unsubscribe(conn.id());
|
||||
}
|
||||
#[cfg(target_os = "macos")]
|
||||
self.update_enable_retina();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,6 +380,17 @@ impl Server {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
fn update_enable_retina(&self) {
|
||||
let mut video_service_count = 0;
|
||||
for (name, service) in self.services.iter() {
|
||||
if Self::is_video_service_name(&name) && service.ok() {
|
||||
video_service_count += 1;
|
||||
}
|
||||
}
|
||||
*scrap::quartz::ENABLE_RETINA.lock().unwrap() = video_service_count < 2;
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Server {
|
||||
|
||||
Reference in New Issue
Block a user