CGDisplayScreenSize() returning incorrect dimensions on some machines
| Originator: | jeremy.knope | ||
| Number: | rdar://12016584 | Date Originated: | 02-Aug-2012 12:30 PM |
| Status: | Open | Resolved: | |
| Product: | Mac OS X | Product Version: | 10.8/12A269 |
| Classification: | Other Bug | Reproducible: | Always |
Summary:
When using CGDisplayScreenSize() to query a display for it's dimensions, on an iMac9,1 the results returned are incorrect. The width dimension is about half of what it should be. This problem didn't exist on 10.7. Other resolutions don't cause this problem, just the native resolution.
Steps to Reproduce:
1. Make sure iMac display is set to native resolution
2. Call CGDisplayScreenSize() on the main iMac display on 10.8
Expected Results:
Should get something at least close to:
{518.80850284657583, 320.84210044459292}
Actual Results:
{262.19354444934476, 324.25531427910988}
Where width is way off. It ends up being about 10" when the width of the iMac 24" screen is around 20". I'm wanting to get the dpi of the screen and this bug ends up getting me 186dpi for width and 94 dpi for height when they should be about the same.
Regression:
Worked on 10.7 returning {518.80850284657583, 320.84210044459292} which produces roughly 94dpi in both directions and is the expected dimensions of the screen.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Reproduced on iMac8,1 running OS X 10.7.5, so the bug does extend back to 10.7 series, at least for this model. There's a report [1] that it works on 10.7.4, but I cannot confirm. If the report is correct, then it seems this bug was introduced in 10.7.5.
[1] http://comments.gmane.org/gmane.comp.lang.r.mac/7457
Anyone know if this information is in a resource file somewhere that can be hand-edited?