mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-28 07:39:36 +08:00
fix get mac display scale, find screen from display id (#8401)
This commit is contained in:
parent
2c38648e39
commit
8c39979848
@ -109,17 +109,17 @@ extern "C" bool MacCheckAdminAuthorization() {
|
||||
return Elevate(NULL, NULL);
|
||||
}
|
||||
|
||||
// https://gist.github.com/briankc/025415e25900750f402235dbf1b74e42
|
||||
extern "C" float BackingScaleFactor(uint32_t display) {
|
||||
NSScreen* s = [NSScreen mainScreen];
|
||||
if (s) return [s backingScaleFactor];
|
||||
/* on my mini mac, display==2, but only 1 screen
|
||||
display -= 1;
|
||||
NSArray<NSScreen *> *screens = [NSScreen screens];
|
||||
if (display >= 0 && display < [screens count]) {
|
||||
NSScreen* s = [screens objectAtIndex:display];
|
||||
if (s) return [s backingScaleFactor];
|
||||
for (NSScreen *screen in screens) {
|
||||
NSDictionary *deviceDescription = [screen deviceDescription];
|
||||
NSNumber *screenNumber = [deviceDescription objectForKey:@"NSScreenNumber"];
|
||||
CGDirectDisplayID screenDisplayID = [screenNumber unsignedIntValue];
|
||||
if (screenDisplayID == display) {
|
||||
return [screen backingScaleFactor];
|
||||
}
|
||||
}
|
||||
*/
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user