Fix use of deprecated screen resolution API.
(This is currently pointless, as the code in question is not used on OS X anyway, but I'd like to see that option come back. In any case, fixes the warning)
This commit is contained in:
parent
fd7cf5bb71
commit
403744dee8
|
@ -154,32 +154,32 @@ wxArrayString GetListOfResolutions()
|
||||||
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
#elif defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
main_frame->m_XRRConfig->AddResolutions(retlist);
|
main_frame->m_XRRConfig->AddResolutions(retlist);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID());
|
CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL);
|
||||||
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
for (CFIndex i = 0; i < CFArrayGetCount(modes); i++)
|
||||||
{
|
{
|
||||||
std::stringstream res;
|
std::stringstream res;
|
||||||
CFDictionaryRef mode;
|
CGDisplayModeRef mode;
|
||||||
CFNumberRef ref;
|
CFStringRef encoding;
|
||||||
int w, h, d;
|
size_t w, h;
|
||||||
|
bool is32;
|
||||||
|
|
||||||
mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i);
|
mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i);
|
||||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth);
|
w = CGDisplayModeGetWidth(mode);
|
||||||
CFNumberGetValue(ref, kCFNumberIntType, &w);
|
h = CGDisplayModeGetHeight(mode);
|
||||||
ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight);
|
encoding = CGDisplayModeCopyPixelEncoding(mode);
|
||||||
CFNumberGetValue(ref, kCFNumberIntType, &h);
|
is32 = CFEqual(encoding, CFSTR(IO32BitDirectPixels));
|
||||||
ref = (CFNumberRef)CFDictionaryGetValue(mode,
|
CFRelease(encoding);
|
||||||
kCGDisplayBitsPerPixel);
|
|
||||||
CFNumberGetValue(ref, kCFNumberIntType, &d);
|
|
||||||
|
|
||||||
if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched))
|
if (!is32)
|
||||||
continue;
|
continue;
|
||||||
if (d != 32)
|
if (CGDisplayModeGetIOFlags(mode) & kDisplayModeStretchedFlag)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
res << w << "x" << h;
|
res << w << "x" << h;
|
||||||
|
|
||||||
retlist.Add(res.str());
|
retlist.Add(res.str());
|
||||||
}
|
}
|
||||||
|
CFRelease(modes);
|
||||||
#endif
|
#endif
|
||||||
return retlist;
|
return retlist;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue