mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-23 19:49:05 +08:00
mac scale factor of each screen (#8368)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
12ff1319f1
commit
60ea8d2c2b
@ -71,7 +71,7 @@ impl Display {
|
||||
}
|
||||
|
||||
pub fn scale(self) -> f64 {
|
||||
let s = unsafe { BackingScaleFactor() as _ };
|
||||
let s = unsafe { BackingScaleFactor(self.0) as _ };
|
||||
if s > 1. {
|
||||
let enable_retina = super::ENABLE_RETINA.lock().unwrap().clone();
|
||||
if enable_retina {
|
||||
|
@ -193,7 +193,7 @@ extern "C" {
|
||||
pub fn CGDisplayIsOnline(display: u32) -> i32;
|
||||
|
||||
pub fn CGDisplayBounds(display: u32) -> CGRect;
|
||||
pub fn BackingScaleFactor() -> f32;
|
||||
pub fn BackingScaleFactor(display: u32) -> f32;
|
||||
|
||||
// IOSurface
|
||||
|
||||
|
@ -109,9 +109,13 @@ extern "C" bool MacCheckAdminAuthorization() {
|
||||
return Elevate(NULL, NULL);
|
||||
}
|
||||
|
||||
extern "C" float BackingScaleFactor() {
|
||||
NSScreen* s = [NSScreen mainScreen];
|
||||
if (s) return [s backingScaleFactor];
|
||||
extern "C" float BackingScaleFactor(uint32_t display) {
|
||||
display -= 1;
|
||||
NSArray<NSScreen *> *screens = [NSScreen screens];
|
||||
if (display >= 0 && display < [screens count]) {
|
||||
NSScreen* s = [screens objectAtIndex:display];
|
||||
if (s) return [s backingScaleFactor];
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user