+ if (mode == wxDefaultVideoMode)
+ {
+ return XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
+ &m_priv->m_DefaultVidMode) == TRUE;
+ }
+ else //This gets kind of tricky AND complicated :) :\ :( :)
+ {
+ bool bRet = false;
+ //Some variables..
+ XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :))
+ int nNumModes; //Number of modes enumerated....
+
+ if(XF86VidModeGetAllModeLines((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()), &nNumModes, &ppXModes) == TRUE)
+ {
+ for (int i = 0; i < nNumModes; ++i)
+ {
+ if (!bRet &&
+ ppXModes[i]->hdisplay == mode.w &&
+ ppXModes[i]->vdisplay == mode.h &&
+ ((ppXModes[i]->hsyncstart + ppXModes[i]->vsyncstart) / 2) == mode.refresh)
+ {
+ //switch!
+ bRet = XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
+ ppXModes[i]) == TRUE;
+ }
+ wxClearXVM((*ppXModes[i]));
+ // XFree(ppXModes[i]); //supposed to free?
+ }
+ XFree(ppXModes);
+
+ return bRet;
+ }
+ else //OOPS!
+ {
+ wxLogSysError("XF86VidModeGetAllModeLines Failed in wxX11Display::ChangeMode()!");
+ return false;
+ }
+ }