Avoid including X11 headers from <wx/glcanvas.h>
It's generally wxWidgets policy not to include platform-specific headers from our own to avoid namespace pollution issues, in this case with names like "None" and "Window".
This commit is contained in:
@@ -10,10 +10,10 @@
|
||||
#ifndef _WX_UNIX_GLX11_H_
|
||||
#define _WX_UNIX_GLX11_H_
|
||||
|
||||
#include <GL/glx.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
class wxGLContextAttrs;
|
||||
class wxGLAttributes;
|
||||
typedef struct __GLXcontextRec* GLXContext;
|
||||
typedef struct __GLXFBConfigRec* GLXFBConfig;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGLContext
|
||||
@@ -30,9 +30,6 @@ public:
|
||||
virtual bool SetCurrent(const wxGLCanvas& win) const wxOVERRIDE;
|
||||
|
||||
private:
|
||||
// attach context to the drawable or unset it (if NULL)
|
||||
static bool MakeCurrent(GLXDrawable drawable, GLXContext context);
|
||||
|
||||
GLXContext m_glContext;
|
||||
|
||||
wxDECLARE_CLASS(wxGLContext);
|
||||
@@ -74,7 +71,7 @@ public:
|
||||
static bool IsGLXMultiSampleAvailable();
|
||||
|
||||
// get the X11 handle of this window
|
||||
virtual Window GetXWindow() const = 0;
|
||||
virtual unsigned long GetXWindow() const = 0;
|
||||
|
||||
|
||||
// GLX-specific methods
|
||||
@@ -93,36 +90,15 @@ public:
|
||||
|
||||
// get the GLXFBConfig/XVisualInfo we use
|
||||
GLXFBConfig *GetGLXFBConfig() const { return m_fbc; }
|
||||
XVisualInfo *GetXVisualInfo() const { return m_vi; }
|
||||
void* GetXVisualInfo() const { return m_vi; }
|
||||
|
||||
// initialize the global default GL visual, return false if matching visual
|
||||
// not found
|
||||
static bool InitDefaultVisualInfo(const int *attribList);
|
||||
|
||||
// get the default GL X11 visual (may be NULL, shouldn't be freed by caller)
|
||||
static XVisualInfo *GetDefaultXVisualInfo() { return ms_glVisualInfo; }
|
||||
|
||||
// free the global GL visual, called by wxGLApp
|
||||
static void FreeDefaultVisualInfo();
|
||||
|
||||
// initializes XVisualInfo (in any case) and, if supported, GLXFBConfig
|
||||
//
|
||||
// returns false if XVisualInfo couldn't be initialized, otherwise caller
|
||||
// is responsible for freeing the pointers
|
||||
static bool InitXVisualInfo(const wxGLAttributes& dispAttrs,
|
||||
GLXFBConfig **pFBC, XVisualInfo **pXVisual);
|
||||
|
||||
private:
|
||||
|
||||
// this is only used if it's supported i.e. if GL >= 1.3
|
||||
GLXFBConfig *m_fbc;
|
||||
|
||||
// used for all GL versions, obtained from GLXFBConfig for GL >= 1.3
|
||||
XVisualInfo *m_vi;
|
||||
|
||||
// the global/default versions of the above
|
||||
static GLXFBConfig *ms_glFBCInfo;
|
||||
static XVisualInfo *ms_glVisualInfo;
|
||||
void* m_vi;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -135,29 +111,15 @@ private:
|
||||
class WXDLLIMPEXP_GL wxGLApp : public wxGLAppBase
|
||||
{
|
||||
public:
|
||||
wxGLApp() : wxGLAppBase() { }
|
||||
|
||||
// implement wxGLAppBase method
|
||||
virtual bool InitGLVisual(const int *attribList) wxOVERRIDE
|
||||
{
|
||||
return wxGLCanvasX11::InitDefaultVisualInfo(attribList);
|
||||
}
|
||||
virtual bool InitGLVisual(const int *attribList) wxOVERRIDE;
|
||||
|
||||
// This method is not currently used by the library itself, but remains for
|
||||
// backwards compatibility and also because wxGTK has it we could start
|
||||
// using it for the same purpose in wxX11 too some day.
|
||||
virtual void* GetXVisualInfo() wxOVERRIDE
|
||||
{
|
||||
return wxGLCanvasX11::GetDefaultXVisualInfo();
|
||||
}
|
||||
virtual void* GetXVisualInfo() wxOVERRIDE;
|
||||
|
||||
// and override this wxApp method to clean up
|
||||
virtual int OnExit() wxOVERRIDE
|
||||
{
|
||||
wxGLCanvasX11::FreeDefaultVisualInfo();
|
||||
|
||||
return wxGLAppBase::OnExit();
|
||||
}
|
||||
virtual int OnExit() wxOVERRIDE;
|
||||
|
||||
private:
|
||||
wxDECLARE_DYNAMIC_CLASS(wxGLApp);
|
||||
|
Reference in New Issue
Block a user