forked from Mirrors/openclonk
X11: Stop including X11 headers from Clonk headers
X11 headers #define common symbols like Status and Success, which leads to very puzzling error messages when included from random Clonk codestable-5.2
parent
760df013ba
commit
ad3c2509ca
|
@ -24,14 +24,6 @@
|
|||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#ifdef USE_X11
|
||||
// Xmd.h typedefs BOOL to CARD8, but we want int
|
||||
#define BOOL _BOOL
|
||||
#include <X11/Xmd.h>
|
||||
#undef BOOL
|
||||
#include <GL/glx.h>
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
|
@ -69,7 +61,7 @@ class CStdGLCtx
|
|||
HWND hWindow; // used if pWindow==NULL
|
||||
HDC hDC; // device context handle
|
||||
#elif defined(USE_X11)
|
||||
GLXContext ctx;
|
||||
/*GLXContext*/void * ctx;
|
||||
#endif
|
||||
int cx,cy; // context window size
|
||||
|
||||
|
|
|
@ -193,7 +193,12 @@ bool CStdGL::ApplyGammaRamp(D3DGAMMARAMP &ramp, bool fForce)
|
|||
|
||||
#elif defined(USE_X11)
|
||||
|
||||
// Xmd.h typedefs BOOL to CARD8, whereas microsoft windows and Clonk use int
|
||||
#define BOOL _BOOL
|
||||
#include <X11/Xmd.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#undef BOOL
|
||||
|
||||
CStdGLCtx::CStdGLCtx(): pWindow(0), ctx(0), cx(0), cy(0) { }
|
||||
|
||||
|
@ -202,7 +207,7 @@ void CStdGLCtx::Clear()
|
|||
Deselect();
|
||||
if (ctx)
|
||||
{
|
||||
glXDestroyContext(pWindow->dpy, ctx);
|
||||
glXDestroyContext(pWindow->dpy, (GLXContext)ctx);
|
||||
ctx = 0;
|
||||
}
|
||||
pWindow = 0;
|
||||
|
@ -218,10 +223,10 @@ bool CStdGLCtx::Init(CStdWindow * pWindow, CStdApp *)
|
|||
// Create Context with sharing (if this is the main context, our ctx will be 0, so no sharing)
|
||||
// try direct rendering first
|
||||
if (!DDrawCfg.NoAcceleration)
|
||||
ctx = glXCreateContext(pWindow->dpy, (XVisualInfo*)pWindow->Info, pGL->MainCtx.ctx, True);
|
||||
ctx = glXCreateContext(pWindow->dpy, (XVisualInfo*)pWindow->Info, (GLXContext)pGL->MainCtx.ctx, True);
|
||||
// without, rendering will be unacceptable slow, but that's better than nothing at all
|
||||
if (!ctx)
|
||||
ctx = glXCreateContext(pWindow->dpy, (XVisualInfo*)pWindow->Info, pGL->MainCtx.ctx, False);
|
||||
ctx = glXCreateContext(pWindow->dpy, (XVisualInfo*)pWindow->Info, (GLXContext)pGL->MainCtx.ctx, False);
|
||||
// No luck at all?
|
||||
if (!ctx) return pGL->Error(" gl: Unable to create context");
|
||||
if (!Select(true)) return pGL->Error(" gl: Unable to select context");
|
||||
|
@ -249,7 +254,7 @@ bool CStdGLCtx::Select(bool verbose)
|
|||
return false;
|
||||
}
|
||||
// make context current
|
||||
if (!pWindow->renderwnd || !glXMakeCurrent(pWindow->dpy, pWindow->renderwnd, ctx))
|
||||
if (!pWindow->renderwnd || !glXMakeCurrent(pWindow->dpy, pWindow->renderwnd, (GLXContext)ctx))
|
||||
{
|
||||
if (verbose) pGL->Error(" gl: glXMakeCurrent failed");
|
||||
return false;
|
||||
|
|
|
@ -30,11 +30,14 @@
|
|||
#include "../../engine/inc/C4Version.h"
|
||||
|
||||
#ifdef USE_X11
|
||||
#define BOOL _BOOL
|
||||
#include "../../engine/res/c4x.xpm"
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/xpm.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include <GL/glx.h>
|
||||
#undef BOOL
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
|
Loading…
Reference in New Issue