]> git.saurik.com Git - wxWidgets.git/commitdiff
Implement restoring default video mode under OS X.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Feb 2011 16:36:18 +0000 (16:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 5 Feb 2011 16:36:18 +0000 (16:36 +0000)
Use CGRestorePermanentDisplayConfiguration() to implement switching to default
video mode in wxOSX wxDisplay implementation.

Closes #12914.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
interface/wx/display.h
src/osx/core/display.cpp

index 0fbb5c6b8c79f4a5a4280d7cbb07f8265a51c245..1605e451e83b8c0370c289f1d2e64e8f93bc0785 100644 (file)
@@ -474,6 +474,9 @@ MSW:
 - Center task dialog-based wxProgressDialog on the parent (John Roberts).
 - wxAutomationObject::GetInstance() creates objects on demand (Kolya Kosenko).
 
+OSX:
+
+- Implement switching to default video mode in wxDisplay (soren).
 
 
 2.9.1:
index 41fd18e95377c0045d1b95391d309cc55105a15c..ab7c9920c0db5b7884931bc01694e2bacdd8bec0 100644 (file)
@@ -44,11 +44,6 @@ public:
         there are differences on other platforms. On Unix variations using X11
         extensions it should behave as defined, but some irregularities may
         occur.
-
-        On wxMac passing in wxDefaultVideoMode as the mode parameter does
-        nothing. This happens because carbon no longer has access to
-        @c DMUseScreenPrefs(), an undocumented function that changed the video
-        mode to the system default by using the system's "scrn" resource.
     */
     bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
 
index 38ca6cba0c041bfac2d07092a34c7677ebf12a11..998eff23f7ecb503209e14d04813a4d0c436c7b1 100644 (file)
@@ -267,10 +267,14 @@ wxVideoMode wxDisplayImplMacOSX::GetCurrentMode() const
 
 bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
 {
-    // Changing to default mode (wxDefaultVideoMode) doesn't
-    // work because we don't have access to the system's 'scrn'
-    // resource which holds the user's mode which the system
-    // will return to after this app is done
+#ifndef __WXOSX_IPHONE__
+    if (mode == wxDefaultVideoMode)
+    {
+        CGRestorePermanentDisplayConfiguration();
+        return true;
+    }
+#endif
+
     boolean_t bExactMatch;
     CFDictionaryRef theCGMode = CGDisplayBestModeForParametersAndRefreshRate(
         m_id,