- }
-
- //0 & NULL for params 2 & 3 of DMSetVideoMode signal it to use defaults (current mode)
- //DM 2.0+ doesn't use params 2 & 3 of DMSetDisplayMode
- //so we have to use this icky structure
- VDSwitchInfoRec sMode;
- memset(&sMode, 0, sizeof(VDSwitchInfoRec) );
-
- DMListIndexType nNumModes;
- DMListType pModes;
- DMDisplayModeListIteratorUPP uppMLI;
- DisplayIDType nDisplayID;
-
- wxASSERT(DMGetDisplayIDByGDevice(m_priv->m_hndl, &nDisplayID, false) == noErr);
- //Create a new list...
- wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
- wxT("Could not create a new display mode list") );
-
- uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc);
- wxASSERT(uppMLI);
-
- DMModeInfoRec sModeInfo;
- sModeInfo.bMatched = false;
- sModeInfo.pMode = &mode;
- unsigned int i;
- for(i = 0; i < nNumModes; ++i)
- {
- wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
- uppMLI, &sModeInfo) == noErr);
- if (sModeInfo.bMatched == true)
- {
- sMode = sModeInfo.sMode;
- break;
- }
- }
- if(i == nNumModes)
- return false;
-
- DisposeDMDisplayModeListIteratorUPP(uppMLI);
- wxASSERT(DMDisposeList(pModes) == noErr);
-
- // For the really paranoid -
- // unsigned long flags;
- // Boolean bok;
- // wxASSERT(noErr == DMCheckDisplayMode(m_priv->m_hndl, sMode.csData,
- // sMode.csMode, &flags, NULL, &bok));
- // wxASSERT(bok);
-
- Handle hDisplayState;
- if (DMBeginConfigureDisplays(&hDisplayState) != noErr)
- {
- wxLogSysError(wxT("Could not lock display for display mode changing!"));
- return false;
- }
-
- unsigned long dwBPP = (unsigned long) mode.bpp;
- if (DMSetDisplayMode(m_priv->m_hndl, sMode.csData,
- (unsigned long*) &(dwBPP), NULL
- //(unsigned long) &sMode
- , hDisplayState
- ) != noErr)
- {
- DMEndConfigureDisplays(hDisplayState);
- wxMessageBox(wxString::Format(wxT("Could not set the display mode")));
+ }
+
+ //0 & NULL for params 2 & 3 of DMSetVideoMode signal it to use defaults (current mode)
+ //DM 2.0+ doesn't use params 2 & 3 of DMSetDisplayMode
+ //so we have to use this icky structure
+ VDSwitchInfoRec sMode;
+ memset(&sMode, 0, sizeof(VDSwitchInfoRec) );
+
+ DMListIndexType nNumModes;
+ DMListType pModes;
+ DMDisplayModeListIteratorUPP uppMLI;
+ DisplayIDType nDisplayID;
+
+ wxASSERT(DMGetDisplayIDByGDevice(m_hndl, &nDisplayID, false) == noErr);
+ //Create a new list...
+ wxASSERT_MSG(DMNewDisplayModeList(nDisplayID, NULL, NULL, &nNumModes, &pModes) == noErr,
+ wxT("Could not create a new display mode list") );
+
+ uppMLI = NewDMDisplayModeListIteratorUPP(DMModeInfoProc);
+ wxASSERT(uppMLI);
+
+ DMModeInfoRec sModeInfo;
+ sModeInfo.bMatched = false;
+ sModeInfo.pMode = &mode;
+ unsigned int i;
+ for(i = 0; i < nNumModes; ++i)
+ {
+ wxASSERT(DMGetIndexedDisplayModeFromList(pModes, i, NULL,
+ uppMLI, &sModeInfo) == noErr);
+ if (sModeInfo.bMatched == true)
+ {
+ sMode = sModeInfo.sMode;
+ break;
+ }
+ }
+ if(i == nNumModes)
+ return false;
+
+ DisposeDMDisplayModeListIteratorUPP(uppMLI);
+ wxASSERT(DMDisposeList(pModes) == noErr);
+
+ // For the really paranoid -
+ // unsigned long flags;
+ // Boolean bok;
+ // wxASSERT(noErr == DMCheckDisplayMode(m_hndl, sMode.csData,
+ // sMode.csMode, &flags, NULL, &bok));
+ // wxASSERT(bok);
+
+ Handle hDisplayState;
+ if (DMBeginConfigureDisplays(&hDisplayState) != noErr)
+ {
+ wxLogSysError(wxT("Could not lock display for display mode changing!"));
+ return false;
+ }
+
+ unsigned long dwBPP = (unsigned long) mode.bpp;
+ if (DMSetDisplayMode(m_hndl, sMode.csData,
+ (unsigned long*) &(dwBPP), NULL
+ //(unsigned long) &sMode
+ , hDisplayState
+ ) != noErr)
+ {
+ DMEndConfigureDisplays(hDisplayState);
+ wxLogError(wxT("Could not set the display mode"));