emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f3dec3439fd 3/4: Get NS screen resolution from system


From: Alan Third
Subject: master f3dec3439fd 3/4: Get NS screen resolution from system
Date: Sat, 30 Dec 2023 06:24:35 -0500 (EST)

branch: master
commit f3dec3439fd5aee885a76622f384f6c7ca67d128
Author: Alan Third <alan@idiocy.org>
Commit: Alan Third <alan@idiocy.org>

    Get NS screen resolution from system
    
    * src/nsterm.m (ns_initialize_display_info): Query the screen
    deviceDescription for the resolution instead of hard-coding it.
---
 src/nsterm.m | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/nsterm.m b/src/nsterm.m
index 2f736980ea6..dc4aef55113 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -5256,8 +5256,11 @@ ns_initialize_display_info (struct ns_display_info 
*dpyinfo)
     NSScreen *screen = [NSScreen mainScreen];
     NSWindowDepth depth = [screen depth];
 
-    dpyinfo->resx = 72.27; /* used 75.0, but this makes pt == pixel, expected 
*/
-    dpyinfo->resy = 72.27;
+    NSDictionary *dict = [screen deviceDescription];
+    NSSize res = [[dict objectForKey:@"NSDeviceResolution"] sizeValue];
+    dpyinfo->resx = res.width;
+    dpyinfo->resy = res.height;
+
     dpyinfo->color_p = ![NSDeviceWhiteColorSpace isEqualToString:
                                                   NSColorSpaceFromDepth 
(depth)]
                 && ![NSCalibratedWhiteColorSpace isEqualToString:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]