> On 29 Jun 2017, at 22:27, James Walker <li...@jwwalker.com> wrote: > > On 6/29/2017 12:59 AM, Martin Crane wrote: >> James, as the author of such an app I can tell you that it’s definitely >> worthwhile overall. For the most part, everything "just works" in HiDPI >> mode, with some exceptions. It’s certainly a huge improvement on the low-res >> pixelated look on retina Macs :) >> >> If you get stuck and need some pointers I’ll be happy to help. > > Since you kindly offered... what's the deal with kHICoordSpace72DPIGlobal and > kHICoordSpaceScreenPixel? I thought it would start making a difference which > of these I use once I go to HiDPI. But at least when calling > HIWindowGetBounds to get the structure or content region of a HiDPI Carbon > window, I get the same result either way. >
I don’t use either of those in my entire app, but you’ll find that HIGetScaleFactor always returns 1.0, which explains why there is no difference in the two. If you’re looking to find a way to pragmatically determine whether your app is running in HiDPI mode, the only way I discovered is something like below, from which I cache the result. -Martin CGContextRef browserContext = 0; WindowRef testWind; Rect r = {0,0,600,600}; Boolean isRetina = false; CreateNewWindow(kDocumentWindowClass,kWindowCompositingAttribute | kWindowFrameworkScaledAttribute, &r, &testWind); if (testWind) { CreateCGContextForPort(GetWindowPort(testWind),&browserContext); if (browserContext) { CGRect deviceRect, userRect; userRect = CGRectMake( 0, 0, 128, 128 ); deviceRect = CGContextConvertRectToDeviceSpace(browserContext, userRect); if (!CGRectEqualToRect(deviceRect, userRect)) { float scaleFactor = deviceRect.size.height / userRect.size.height; if (scaleFactor != 1.0) isRetina = true; } CGContextRelease(browserContext); } DisposeWindow(testWind); } return isRetina;
_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (Carbon-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/carbon-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com