X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/85866f52b3fe2c781e57cf20354306c3dc23f34e..92c01615ecb4afeb325e5148554b443fed830534:/src/unix/glx11.cpp diff --git a/src/unix/glx11.cpp b/src/unix/glx11.cpp index b4a8b2d147..780029891d 100644 --- a/src/unix/glx11.cpp +++ b/src/unix/glx11.cpp @@ -68,26 +68,26 @@ wxGLContext::~wxGLContext() glXDestroyContext( wxGetX11Display(), m_glContext ); } -void wxGLContext::SetCurrent(const wxGLCanvas& win) const +bool wxGLContext::SetCurrent(const wxGLCanvas& win) const { if ( !m_glContext ) - return; + return false; const Window xid = win.GetXWindow(); - wxCHECK_RET( xid, _T("window must be shown") ); + wxCHECK2_MSG( xid, return false, _T("window must be shown") ); - MakeCurrent(xid, m_glContext); + return MakeCurrent(xid, m_glContext); } // wrapper around glXMakeContextCurrent/glXMakeCurrent depending on GLX // version /* static */ -void wxGLContext::MakeCurrent(GLXDrawable drawable, GLXContext context) +bool wxGLContext::MakeCurrent(GLXDrawable drawable, GLXContext context) { if (wxGLCanvas::GetGLXVersion() >= 13) - glXMakeContextCurrent( wxGetX11Display(), drawable, drawable, context); + return glXMakeContextCurrent( wxGetX11Display(), drawable, drawable, context); else // GLX <= 1.2 doesn't have glXMakeContextCurrent() - glXMakeCurrent( wxGetX11Display(), drawable, context); + return glXMakeCurrent( wxGetX11Display(), drawable, context); } // ============================================================================ @@ -297,6 +297,24 @@ wxGLCanvasX11::InitXVisualInfo(const int *attribList, return *pXVisual != NULL; } +/* static */ +bool +wxGLCanvasBase::IsDisplaySupported(const int *attribList) +{ + GLXFBConfig *fbc = NULL; + XVisualInfo *vi = NULL; + + const bool + isSupported = wxGLCanvasX11::InitXVisualInfo(attribList, &fbc, &vi); + + if ( fbc ) + XFree(fbc); + if ( vi ) + XFree(vi); + + return isSupported; +} + // ---------------------------------------------------------------------------- // default visual management // ---------------------------------------------------------------------------- @@ -351,12 +369,13 @@ int wxGLCanvasX11::GetGLXVersion() return s_glxVersion; } -void wxGLCanvasX11::SwapBuffers() +bool wxGLCanvasX11::SwapBuffers() { const Window xid = GetXWindow(); - wxCHECK_RET( xid, _T("window must be shown") ); + wxCHECK2_MSG( xid, return false, _T("window must be shown") ); glXSwapBuffers(wxGetX11Display(), xid); + return true; } bool wxGLCanvasX11::IsShownOnScreen() const