From 403744dee83b04cdc27284491d121d045c64a99c Mon Sep 17 00:00:00 2001 From: comex Date: Thu, 29 Aug 2013 01:42:45 -0400 Subject: [PATCH] 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) --- Source/Core/DolphinWX/Src/VideoConfigDiag.cpp | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index a606bf413e..0721ed3689 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -154,32 +154,32 @@ wxArrayString GetListOfResolutions() #elif defined(HAVE_XRANDR) && HAVE_XRANDR main_frame->m_XRRConfig->AddResolutions(retlist); #elif defined(__APPLE__) - CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID()); + CFArrayRef modes = CGDisplayCopyAllDisplayModes(CGMainDisplayID(), NULL); for (CFIndex i = 0; i < CFArrayGetCount(modes); i++) { std::stringstream res; - CFDictionaryRef mode; - CFNumberRef ref; - int w, h, d; + CGDisplayModeRef mode; + CFStringRef encoding; + size_t w, h; + bool is32; - mode = (CFDictionaryRef)CFArrayGetValueAtIndex(modes, i); - ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayWidth); - CFNumberGetValue(ref, kCFNumberIntType, &w); - ref = (CFNumberRef)CFDictionaryGetValue(mode, kCGDisplayHeight); - CFNumberGetValue(ref, kCFNumberIntType, &h); - ref = (CFNumberRef)CFDictionaryGetValue(mode, - kCGDisplayBitsPerPixel); - CFNumberGetValue(ref, kCFNumberIntType, &d); + mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(modes, i); + w = CGDisplayModeGetWidth(mode); + h = CGDisplayModeGetHeight(mode); + encoding = CGDisplayModeCopyPixelEncoding(mode); + is32 = CFEqual(encoding, CFSTR(IO32BitDirectPixels)); + CFRelease(encoding); - if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched)) + if (!is32) continue; - if (d != 32) + if (CGDisplayModeGetIOFlags(mode) & kDisplayModeStretchedFlag) continue; res << w << "x" << h; retlist.Add(res.str()); } + CFRelease(modes); #endif return retlist; }