From befe6e696212ea7f997302f3233442c4f18cc890 Mon Sep 17 00:00:00 2001 From: Braden Date: Mon, 18 Mar 2013 21:40:46 -0500 Subject: [PATCH] Short,sweet and fixes issue 5725 --- Source/Core/DolphinWX/Src/FrameTools.cpp | 42 ++++-------------------- 1 file changed, 7 insertions(+), 35 deletions(-) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index d41fe96a14..f9d737d05e 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -35,7 +35,7 @@ Core::GetWindowHandle(). #include "VideoBackendBase.h" #ifdef __APPLE__ -#include +#include #endif #include "Globals.h" // Local @@ -805,41 +805,13 @@ void CFrame::ToggleDisplayMode(bool bFullscreen) #elif defined(HAVE_XRANDR) && HAVE_XRANDR m_XRRConfig->ToggleDisplayMode(bFullscreen); #elif defined __APPLE__ - if (!bFullscreen) { - CGRestorePermanentDisplayConfiguration(); - CGDisplayRelease(CGMainDisplayID()); + NSView* view = (NSView *)m_RenderFrame->GetHandle(); + [[view window] toggleFullScreen:[view window]]; + + if(bFullscreen) + CGDisplayHideCursor(CGMainDisplayID()); + else CGDisplayShowCursor(CGMainDisplayID()); - return; - } - - CGDisplayHideCursor(CGMainDisplayID()); - CFArrayRef modes = CGDisplayAvailableModes(CGMainDisplayID()); - for (CFIndex i = 0; i < CFArrayGetCount(modes); i++) - { - CFDictionaryRef mode; - CFNumberRef ref; - int x, y, w, h, d; - - sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.\ - strFullscreenResolution.c_str(), "%dx%d", &x, &y); - - 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); - - if (CFDictionaryContainsKey(mode, kCGDisplayModeIsStretched)) - continue; - if (w != x || h != y || d != 32) - continue;; - - CGDisplaySwitchToMode(CGMainDisplayID(), mode); - } - #endif }