[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is the version of MacOS available to CPP ?
From: |
Ben Abbott |
Subject: |
Re: Is the version of MacOS available to CPP ? |
Date: |
Sun, 10 Jun 2012 15:17:42 -0400 |
On Jun 10, 2012, at 12:49 PM, Ben Abbott wrote:
> On Jun 9, 2012, at 11:18 AM, Ben Abbott wrote:
>
>> With MacOS 10.7.x, Apple has deprecated CGDisplayBitsPerPixel. Adding the
>> code below to display.cc will allow the sources to be built with
>> "--with-framework-carbon", but isn't the right solution for earlier versions
>> of MacOS X.
>>
>> #if defined (HAVE_FRAMEWORK_CARBON)
>> size_t CGDisplayBitsPerPixel (CGDirectDisplayID display)
>> {
>> CGDisplayModeRef mode = CGDisplayCopyDisplayMode (display);
>> CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding (mode);
>>
>> if (CFStringCompare (pixelEncoding, CFSTR (IO32BitDirectPixels), 0) == 0)
>> return 32;
>> else if (CFStringCompare (pixelEncoding, CFSTR (IO16BitDirectPixels), 0) ==
>> 0)
>> return 16;
>> else
>> return 8;
>> }
>> #endif
>>
>> Is the version of MacOS X available to the preprocessor ?
>>
>> Ben
>
> The link below has a solution that does not require preprocessing.
>
>
> http://stackoverflow.com/questions/8210824/how-to-avoid-cgdisplaymodecopypixelencoding-to-get-bpp
>
> ... but looks to be written in objective-c (?), which I have no experience
> with.
>
> Unless I've overlooked something, the only part I'm having trouble with is
> below.
>
> CFNumberGetValue((CFNumberRef)CFDictionaryGetValue(currentDisplayMode,
> kCGDisplayBitsPerPixel), kCFNumberIntType, &screenBPP);
>
> I'm hoping someone can provide a quick translation to c++.
>
> TiA,
> Ben
I think I managed to understand how the code at the link above works, and
produced a c++ version.
Alexander,
The attached changeset works for me on MacOS 10.7 using both the default and
stable branches.
Can you (someone else?) try the attached changeset on MacOS 10.5 ?
Ben
changeset.patch
Description: Binary data
- Re: Looking for MacOS 10.5 testers, (continued)
- Re: Looking for MacOS 10.5 testers, Alexander Hansen, 2012/06/15
- Re: Looking for MacOS 10.5 testers, Alexander Hansen, 2012/06/15
- Re: Looking for MacOS 10.5 testers, Ben Abbott, 2012/06/15
- Re: Looking for MacOS 10.5 testers, Ben Abbott, 2012/06/16
- Re: Looking for MacOS 10.5 testers, Ben Abbott, 2012/06/16
- Message not available
- Re: Looking for MacOS 10.5 testers, Ben Abbott, 2012/06/17
- Re: Looking for MacOS 10.5 testers, Ben Abbott, 2012/06/17
- Re: Looking for MacOS 10.5 testers, Alexander Hansen, 2012/06/17
- Re: Looking for MacOS 10.5 testers, Ben Abbott, 2012/06/17
Re: Is the version of MacOS available to CPP ?, Ben Abbott, 2012/06/10
- Re: Is the version of MacOS available to CPP ?,
Ben Abbott <=