From: Vadim Zeitlin Date: Sat, 5 Feb 2011 16:36:18 +0000 (+0000) Subject: Implement restoring default video mode under OS X. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c20389eb5f082ff915298f78494ebec0bf039570 Implement restoring default video mode under OS X. 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 --- diff --git a/docs/changes.txt b/docs/changes.txt index 0fbb5c6b8c..1605e451e8 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -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: diff --git a/interface/wx/display.h b/interface/wx/display.h index 41fd18e953..ab7c9920c0 100644 --- a/interface/wx/display.h +++ b/interface/wx/display.h @@ -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); diff --git a/src/osx/core/display.cpp b/src/osx/core/display.cpp index 38ca6cba0c..998eff23f7 100644 --- a/src/osx/core/display.cpp +++ b/src/osx/core/display.cpp @@ -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,